-
Notifications
You must be signed in to change notification settings - Fork 861
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
Fail to reformat by JDK17 for Pattern Matching for instanceof #768
Comments
Reproduced in 2022.1.2 with plugin 1.15.0.0 (formatter 1.15.0) on Temurin-17.0.2+8. https://github.com/spotify/fmt-maven-plugin and https://github.com/diffplug/spotless both appear to handle this construction perfectly, so it seems specific to the IntelliJ plugin rather than to the library generally. |
Is this when running IDEA itself with JDK 17 ? or only using JDK 17 as the "project JDK" ? See #533 |
I was using 17 as the project JDK while using the default 11 runtime for the IDE. However, I can also reproduce this on the 2022.2 EAP version of IntelliJ, which runs on their bundled 17.0.3+7-469.3-jcef runtime at the moment. |
In my case, it works fine with project JDK 17 & JBR 11. It fails after I update IDEA to 2022.2, which switches to JBR 17 by default. |
I think this is covered by the issues @tbroyer mentioned. The formatter itself can handle these constructs, but only when running on a JVM that supports them:
|
https://openjdk.java.net/jeps/394
idea version: 2021.3.2 (Ultimate Edition)
plugin version: 1.15.0.0
JDK version: Amazon corretto 17.0.2
the reformat doesn't work, if has the code below:
the reformat will work, if I delete any code with "Pattern Matching for instanceof" operator
The text was updated successfully, but these errors were encountered: