-
Notifications
You must be signed in to change notification settings - Fork 55
Java 21 with Graal support #1211
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
Conversation
javac no longer accepts these, see https://bugs.openjdk.org/browse/JDK-8027682 PiperOrigin-RevId: 525775880
This PR adds support for `switch` statements where a `case` has a guard clause. See Issue #983 Fixes #988 COPYBARA_INTEGRATE_REVIEW=google/google-java-format#988 from TheCK:master 4771486db7d8aab84eb4ecf8e68af2612d0c2b5c PiperOrigin-RevId: 588913297
Fixes google/google-java-format#937, google/google-java-format#880 PiperOrigin-RevId: 589140113
+ " incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis" | ||
+ " nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo" | ||
+ " consequat."); | ||
System.err.println( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a bug in palantir-java-format that doesn't wrap long strings when running through the Intellij plugin - https://github.com/palantir/palantir-java-format/blob/develop/palantir-java-format/src/main/java/com/palantir/javaformat/java/FormatFileCallable.java#L51 vs https://github.com/palantir/palantir-java-format/blob/develop/palantir-java-format/src/main/java/com/palantir/javaformat/java/FormatFileCallable.java#L70. I will fix this in a separate PR
@@ -11,8 +11,3 @@ dependencies { | |||
testImplementation 'org.junit.jupiter:junit-jupiter' | |||
testImplementation 'com.fasterxml.jackson.core:jackson-databind' | |||
} | |||
|
|||
tasks.withType(JavaCompile).named('compileJava') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved all the *Compatibility blocks to the root build.gradle in the subprojects
block. We need to set the sourceCompatibility for groovy sourceSets as well, so I think it is better to always set the source & target compatibility to 11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to set the sourceCompatibility for the groovy source sets too? If we can, I'd like to contain this strangeness to just the place that needs, ie the code for running the actual formatter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might avoid being able to do this by keeping libraryTarget = 17
on the root project (so the gradle plugin, idea plugin etc use 17) then putting libraryTarget = 21
on the palantir-java-format
and palantir-java-format-spi
projects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I mean target = 21
in the subprojects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed in ff54182
@@ -1,56 +0,0 @@ | |||
[ | |||
{ | |||
"name":"[Lcom.fasterxml.jackson.databind.deser.Deserializers;" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
old file that was generated with graal 21 - now we are using reachability-metadata: https://github.com/palantir/palantir-java-format/pull/1211/files#diff-08891f153c2557b2f9c4131cb3f735dda8476f2f55ed91e9227b769ebe069991R87
build.gradle
Outdated
} | ||
|
||
jdks { | ||
daemonTarget = 17 | ||
daemonTarget = 21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need daemonTarget 21?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, but since everything else would use java 21, I thought it is OK to move the daemon as well.
Moved it back to 17 5ca751c
@@ -67,7 +71,8 @@ subprojects { | |||
} | |||
|
|||
javaVersions { | |||
libraryTarget = 17 | |||
libraryTarget = 21 | |||
runtime = 21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libraryTarget
implies runtime
, I think we can just leave this out to keep it like our other Gradle plugins.
👍 |
Released 2.57.0 |
Before this PR
No java 21 support
After this PR
Java 21 support that can run either through the native-image - by setting the gradle property
palantir.native.formatter=true
or - by default - using the java-based implementation.Adds the following support:
==COMMIT_MSG==
Java 21 Support with Graal & Java-based Implementations
==COMMIT_MSG==
FLUPs:
Possible downsides?