-
Notifications
You must be signed in to change notification settings - Fork 321
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
Initial preparation for Java 21 #2986
Conversation
what was the background behind the SuppressWarnings change? (and other stubs) in the past we did if (JavaRuntimeVersion.isJava17OrLater()) .... |
It's documented here 2791444#diff-331411999fe50a10ba8910972acaf1b716881e03a7f535f17573f49c8aabe528R18
Concerning the stub classes in general it was suggested/discussed here #2686 (comment) by @szarnekow When it was unavoidable or simply easier I used the JavaRuntimeVersion but for other cases I created stubbed classes to keep use safer for future Java API evolution and to have our tests less fragile w.r.t. Java API evolutions. |
de23e17
to
303fda4
Compare
@cdietrich @szarnekow I rebased the PR on top of current Could you please give it a look and in case approve it so that I can continue working on the Java 21 issue? |
i am ok with the changes. @szarnekow wdyt |
4e695af
to
6ee5c8c
Compare
6ee5c8c
to
94b6c73
Compare
2a40f09
to
d87ad74
Compare
d87ad74
to
8f8b905
Compare
I rebased on the current main. I recently added this 8f8b905 Finally, I'd like this one to be merged ASAP, please: my other fork's branch where I further experiment with Java 21 is build on top of this, and rebasing both this and the other branch is becoming a burden. |
ef482c9
to
ad4edb4
Compare
otherwise the descriptor goals fails analyzing class files compiled with Java 21
because in Java 21 getLast() has been introduced, throwing NoSuchElementException instead of returning null
To avoid interefence with the new Java 21 method getLast
or the test will fail in Java 21
The test publicNativeMethod was indeed testing "publicStrictFpMethod": copy and paste error?
strictfp has no effect since Java 17 https://openjdk.org/jeps/306 and it doesn't seem to be present at runtime in 17+ see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=545510#c6 for sure, it fails with Java 21
because in Java 21 getLast() has been introduced, throwing NoSuchElementException instead of returning null
using Stubbed types
A stub type to use instead of relying on Java API, which, in Java 21 has lost the java.lang.annotation.Target} specification.
or they would fail due to Java 21 getLast method
ad4edb4
to
d3c35d7
Compare
@cdietrich @szarnekow I rebased and I'm waiting for the build to finished, then I'll merge this one and prepare the PR for the actual Java 21 support. |
This is part of #2686
It adds another GitHub Actions workflow for building with JDK21 (only in Linux to avoid matrix explosion), making sure that everything builds and tests are green with Java 21 and Java 17.
Many tests had to be adapted:
wait0
.strictfp
doesn't seem to be present in the byte code anymore when compiling with JDK 21 so the corresponding tests are skipped with Java 21. By the way, a few tests wherestrictfp
was tested contained a copy-and-paste error andpublicFinalMethod
was never tested (this has been fixed)lastOrNull
(Added IterableExtensions.lastOrNull and deprecated last #2983) is used only when strictly needed in test inputs.maven-plugin-plugin
has been updated or it couldn't build plugin descriptor for Java 21IMPORTANT: this does NOT make the JDK compile with
target
21: the target is still 11; so, it doesn't test byte code with Java version 21; at least, that's my understanding. This means that Maven jdt.core has NOT been upgraded yet; similarly, the Java enum has not been updated. That part will be dealt with in a further PR.JDK 21 is enforced with the toolchains: an automatic Maven profile is activated automatically. In that profile, the
release
option is21
as well. Toolchains is not activated otherwise.This is just the initial step towards Java 21, and I think it might be worthwhile to merge, if you think that's fine.