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

Modules which use nb-javac can't change their source/target/release level #6817

Open
mbien opened this issue Dec 8, 2023 · 0 comments · May be fixed by #7201
Open

Modules which use nb-javac can't change their source/target/release level #6817

mbien opened this issue Dec 8, 2023 · 0 comments · May be fixed by #7201
Labels
build nb-javac Run nb-javac integration tests

Comments

@mbien
Copy link
Member

mbien commented Dec 8, 2023

Modules which use nb-javac (requires.nb.javac=true in project.properties) can't change their source level at the moment since they prepend the bootclasspath and this is only allowed on java 8.

https://www.oracle.com/java/technologies/javase/9-relnotes.html

The boot class path has been mostly removed in this release. The java -Xbootclasspath and -Xbootclasspath/p options have been removed. The javac -bootclaspath option can only be used when compiling to JDK 8 or older. The system property sun.boot.class.path has been removed. Deployments that rely on overriding platform classes for testing purposes with -Xbootclasspath/p will need to changed to use the --patch-module option that is documented in JEP 261. The -Xbootclasspath/a option is unchanged.

consequences:

  • since target isn't (and can't) be set either once boot cp is modified, no API checks are active (!)
  • code is linked against the build JDK (!) (this already has caused problems in past if I remember correctly)
  • the release has to be built with the min required JDK and CI has to catch API version bugs since safeties are off
  • code is stuck to Java 8 syntax

some thoughts:

  • --patch-module (JEP 261) might work if nb-javac was a JPMS module?
  • making a JPMS module out of nb-javac is likely easy and would have the benefit to be able to drop the jackpot transformation step, since projects like https://github.com/kohlschutter/jdk.compiler.standalone indicate that upstream javac code is kept on JDK 11 language level, it can be built with no transformation
  • some modules might be buildable without nb-javac if release is set to 17 or later, which could be a way to reduce usage of requires.nb.javac=true in NB 22+
  • i don't think there is a immediate need to fix this but at some point this is going to become more pressing.
  • it might be worth to explore if a new flag like test.requires.nb.javac=true would make sense, since many modules do only set the flag right now to be able to run the tests.
@mbien mbien added build nb-javac Run nb-javac integration tests labels Dec 8, 2023
@mbien mbien added Ant [ci] enable "build tools" tests and removed Ant [ci] enable "build tools" tests labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build nb-javac Run nb-javac integration tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant