-
Notifications
You must be signed in to change notification settings - Fork 48
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
Cherry-pick upstream fixes for switch expressions with pattern matching #1155
base: develop
Are you sure you want to change the base?
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
Generate changelog in
|
@@ -97,3 +95,8 @@ idea.project.ipr.withXml { xml -> | |||
jdks { | |||
daemonTarget = 17 | |||
} | |||
|
|||
javaVersions { | |||
libraryTarget = 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.
I think one of the tricky parts here is IntelliJ runs with 17 rather than 21. In the IntelliJ plugin, we're probably going to have fork out to a new java process to run the formatting in a 21 JDK (there is already some code that does this iirc but it's slow. This is probably the impetus to get us to always fork but persist the JDK for a bit to make it fast).
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.
This is the existing code that uses the configured project JDK for running the formatter: #562
But yeah, it's slow given it spins up a new JVM for each format command.
@@ -97,3 +95,8 @@ idea.project.ipr.withXml { xml -> | |||
jdks { | |||
daemonTarget = 17 | |||
} | |||
|
|||
javaVersions { | |||
libraryTarget = 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.
Will need to test how this works in gradle too. I suspect while we still support Java 17 in our gradle plugins we're going to have to do something a bit cleverer here too. This may also be the impetus to get us off spotless (or just upgrade every project to use 21 Gradle runtime).
@@ -97,3 +95,8 @@ idea.project.ipr.withXml { xml -> | |||
jdks { | |||
daemonTarget = 17 | |||
} | |||
|
|||
javaVersions { | |||
libraryTarget = 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.
And there is eclipse... which I have no idea about. Perhaps now is the moment to remove support - we do not support eclipse at all internally at Palantir any more.
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 guess we could make it do the same external JDK spinning up code we will end up doing for IntelliJ
Before this PR
After this PR
Cherry-pick the relevant commits to support java 21 style pattern matching in switch expressions.
Also setting java runtime to 21
==COMMIT_MSG==
Cherry-pick upstream changes to support java 21 style pattern matching
==COMMIT_MSG==
Possible downsides?