-
Notifications
You must be signed in to change notification settings - Fork 4k
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
@bazel_tools//tools/java/runfiles:auto_bazel_repository_processor does not compile with JDK 8 #17458
Labels
Comments
Thanks for the detailed report, I prepared a fix at #17458 that can be cherry-picked into Bazel 6.1. |
ShreeM01
added a commit
that referenced
this issue
Feb 16, 2023
The three-argument overload of `Stream#iterate` is only available as of Java 9. Fixes #17458 Closes #17460. PiperOrigin-RevId: 509885763 Change-Id: If83d832b3590b8598c0f4163afa3c7054e7c9786 Co-authored-by: Fabian Meumertzheim <[email protected]>
I'm seeing this issue with bazel 6.1.2. (It worked in 5.3.2.) Looking at 420659a, it looks like it made it into various |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of the bug:
Our internal build uses JDK 11 to build code against JDK 8, using the JDK 8 bootclasspath. When upgrading to Bazel 6, the Java runfiles library fails to compile:
This appears to be occurring because the three-argument
Stream.iterate
method used here:bazel/tools/java/runfiles/AutoBazelRepositoryProcessor.java
Lines 84 to 90 in 338bbc0
does not exist in JDK 8, there is only a two-argument one. It was added in JDK 9 (JDK 11 docs here.
A simple enough fix would be to replace this
Stream
call with afor
loop, which seems to work for me locally. I can prepare a PR should this be desirable. My understanding is that while Bazel itself needs JDK 11, Bazel should still be able to compile code for JDK 8, including libraries intended to be loaded by end-users like this one.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Since this only uses the standard library, you can just use
javac
from JDK 8 without invoking Bazel:javac tools/java/runfiles/AutoBazelRepositoryProcessor.java
Reproduced using OpenJDK 11 using the OpenJDK 8 bootclasspath, and OpenJDK 8 itself.
Which operating system are you running Bazel on?
Linux (Alma 8 aarch64, CentOS 7 amd64)
What is the output of
bazel info release
?6.0.0-vmware
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
#17281 is in the same area, but does not correspond to this precise issue.
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: