-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java runtime mismatch (JDK 11 instead of JDK 8) on Bazel@HEAD #8539
Comments
I narrowed the problem down to switching to alternative toolchain in bazelrc file, with all warnings enabled per default: diff --git a/.bazelrc b/.bazelrc
index d6d4ce6cd3..4a89eed7c9 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -3,7 +3,6 @@ build --repository_cache=~/.gerritcodereview/bazel-cache/repository
build --experimental_strict_action_env
build --action_env=PATH
build --disk_cache=~/.gerritcodereview/bazel-cache/cas
-build --java_toolchain //tools:error_prone_warnings_toolchain
test --build_tests_only
test --test_output=errors The error prone toolchain is defined here: https://gerrit.googlesource.com/gerrit/+/refs/heads/master/tools/BUILD#16. @cushon @iirina @meisterT Any clue why target java version is swapped to 55 in this case? |
Update: I don't see this problem on Bazel 0.26.0. In case it's relevant how I'm building Bazel from HEAD:
|
@davido Thanks for the bug report. I'll take a closer look later this week. |
Thanks @davido. That's what I suspected as well. I'm trying to understand why bad5a2b caused this regression. By looking at how I'm still looking into why the regression happened to come up with a proper fix. If you are blocked by this you can add
to your toolchain definition. |
You mean major version 52, right? With 0.26 the produced byte code is correct and is major version 52. |
I actually meant 54 because the javac version used by Bazel 0.26 comes from JDK 10. The jar's major version with bazel@head comes from the javac version used (i.e. java 11 -> 55). |
Oh, for some reason I though The previous javac version had a non-standard modification to default to the Java 8 language level, which wasn't carried forward to 11. That explains the change. |
Thanks @cushon for the explanation. The default @davido does adding |
Let me know what needs to be cherrypicked for 0.27. |
The previous javac version used by the default_java_toolchain in Bazel had a non-standard modification to default to the Java 8 language level, which wasn't carried forward to 11. Adding default values for {source,target}_version in the default_java_toolchain to keep Bazel backwards compatibility. Fixes #8539. Closes #8569. PiperOrigin-RevId: 251848351
The previous javac version used by the default_java_toolchain in Bazel had a non-standard modification to default to the Java 8 language level, which wasn't carried forward to 11. Adding default values for {source,target}_version in the default_java_toolchain to keep Bazel backwards compatibility. Fixes #8539. Closes #8569. PiperOrigin-RevId: 251848351
The previous javac version used by the default_java_toolchain in Bazel had a non-standard modification to default to the Java 8 language level, which wasn't carried forward to 11. Adding default values for {source,target}_version in the default_java_toolchain to keep Bazel backwards compatibility. Fixes bazelbuild#8539. Closes bazelbuild#8569. PiperOrigin-RevId: 251848351
The previous javac version used by the default_java_toolchain in Bazel had a non-standard modification to default to the Java 8 language level, which wasn't carried forward to 11. Adding default values for {source,target}_version in the default_java_toolchain to keep Bazel backwards compatibility. Fixes bazelbuild#8539. Closes bazelbuild#8569. PiperOrigin-RevId: 251848351
On most recent Bazel@HEAD (eb53de2), after building with Java 8, the final artifact doesn't run, because it is producing java version 55:
I am using Java 8:
To reproduce on Gerrit Code Review run:
And then check java version:
The text was updated successfully, but these errors were encountered: