Skip to content
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

Diagnose incompatible Java system classpaths #19547

Closed
wants to merge 1 commit into from

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Sep 18, 2023

When the Java system classpath extracted from the target Java runtime is more recent than the Java runtime used for Java compilation, JavaBuilder now emits a [BazelJavaConfiguration] diagnostic with actionable information instead of a bunch of "bad class file" errors on module-info files.

Example:

error: [BazelJavaConfiguration] The Java 17 runtime used to run javac is not recent enough to compile for the Java 20 runtime in external/remotejdk20_linux. Either register a Java toolchain with a newer java_runtime or specify a lower --java_runtime_version.

Work towards #17281

@fmeum fmeum requested a review from a team as a code owner September 18, 2023 10:22
@fmeum fmeum requested review from cushon and removed request for a team September 18, 2023 10:22
@github-actions github-actions bot added awaiting-review PR is awaiting review from an assigned reviewer team-Rules-Java Issues for Java rules labels Sep 18, 2023
@fmeum
Copy link
Collaborator Author

fmeum commented Sep 18, 2023

Stacked on #19546

@fmeum
Copy link
Collaborator Author

fmeum commented Sep 18, 2023

I am having a hard time getting the correct Java compilation runtime selected in the tests. I will look into this again after the first review.

@fmeum
Copy link
Collaborator Author

fmeum commented Sep 18, 2023

I am having a hard time getting the correct Java compilation runtime selected in the tests. I will look into this again after the first review.

Turns out that @bazel_tools//tools/jdk:toolchain_java11 uses a JDK 17 as its compilation runtime, possibly just because this definition wasn't updated when the default became JDK 17 instead of JDK 11. Is this intended?

@fmeum fmeum force-pushed the diagnose-system-classpath branch 3 times, most recently from e581976 to e65811e Compare September 20, 2023 11:07
@hvadehra hvadehra added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Oct 2, 2023
@iancha1992
Copy link
Member

@fmeum can you please take a look at the conflicts? Thanks
cc: @bazelbuild/triage

When the Java system classpath extracted from the target Java runtime
is more recent than the Java runtime used for Java compilation,
JavaBuilder now emits a `[BazelJavaConfiguration]` diagnostic with
actionable information instead of a bunch of "bad class file" errors
on `module-info` files.

Example:
```
error: [BazelJavaConfiguration] The Java 17 runtime used to run javac is not recent enough to compile for the Java 20 runtime in external/remotejdk20_linux. Either register a Java toolchain with a newer java_runtime or specify a lower --java_runtime_version.
```
@fmeum
Copy link
Collaborator Author

fmeum commented Oct 5, 2023

@iancha1992 Done!

@copybara-service copybara-service bot closed this in caa6b76 Oct 5, 2023
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Oct 5, 2023
@fmeum fmeum deleted the diagnose-system-classpath branch October 5, 2023 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-Java Issues for Java rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants