test: use Java 17 to produce Java 8-compatible bytecode#1681
test: use Java 17 to produce Java 8-compatible bytecode#1681suztomo merged 5 commits intogoogleapis:mainfrom suztomo:main
Conversation
|
"build(8) except for gapic-generator-java" was stuck: Retrying. |
|
|
||
| // ProcessHandle was introduced in Java 9 | ||
| System.out.println("ProcessHandle: " + java.lang.ProcessHandle.current()); | ||
| System.out.println("org.graalvm.home.Version: " + org.graalvm.home.Version.parse("1.2.3")); |
There was a problem hiding this comment.
This org.graalvm.home.Version class is compiled for Java 11. Java 8 shouldn't be able to load it.
When using openjdk version "17.0.6" 2023-01-17, the Maven test sdk-platform-java$ mvn test -am -pl gax-java/gax-grpc (without the jvm property) succeeds.
There was a problem hiding this comment.
The Java 8 check https://github.com/googleapis/sdk-platform-java/actions/runs/4982584325/jobs/8918462230?pr=1681 successfully detected this gap:
Error: Errors:
Error: ChannelPoolTest.callShouldCompleteAfterCreation:254 » UnsupportedClassVersion org/graalvm/home/Version has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Error: ChannelPoolTest.callShouldCompleteAfterStarted:303 » UnsupportedClassVersion org/graalvm/home/Version has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
|
"build(8) except for gapic-generator-java" passed: https://github.com/googleapis/sdk-platform-java/actions/runs/4982039825/jobs/8918034299 |
| - name: Run test with Java 8 for all modules except gapic-generator-java | ||
| shell: bash | ||
| run: | | ||
| set -x | ||
| export JAVA_HOME=$JAVA8_HOME | ||
| export PATH=${JAVA_HOME}/bin:$PATH | ||
| # useIncrementalCompilation=false to avoid recompiling classes | ||
| # generated by Java 11 compiler above. | ||
| mvn -B -ntp test --projects '!gapic-generator-java' \ | ||
| -Dcheckstyle.skip -Dmaven.compiler.useIncrementalCompilation=false \ | ||
| -Dfmt.skip |
There was a problem hiding this comment.
Note: We used to run two Maven commands, one to compile and the other to run tests. However, the same thing can be done in one Maven command with surefire's jvm system property. This pull request includes that simplification.
| env_vars: { | ||
| key: "TRAMPOLINE_IMAGE" | ||
| value: "gcr.io/cloud-devrel-kokoro-resources/java11" | ||
| value: "gcr.io/cloud-devrel-kokoro-resources/java17" |
There was a problem hiding this comment.
We'll produce Java 8-compatible bytecode using Java 17.
|
[gapic-generator-java-root] Kudos, SonarCloud Quality Gate passed! |
|
[java_showcase_integration_tests] Kudos, SonarCloud Quality Gate passed! |
|
[java_showcase_unit_tests] Kudos, SonarCloud Quality Gate passed! |
|
Confirming without a real release. Build ID b0a899d7-ed51-4b8b-b32b-0fb91876eac6 |
|
I confirmed the generated class files are for Java 8. |








Uh oh!
There was an error while loading. Please reload this page.