-
Notifications
You must be signed in to change notification settings - Fork 870
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
Java 17 Pattern Matching for Switch (JEP-406) compatibility issue #684
Comments
This appears to be a duplicate of #683 (which turns out to not only apply when throwing exceptions). |
copybara-service bot
pushed a commit
that referenced
this issue
Nov 19, 2021
#684 PiperOrigin-RevId: 411079223
copybara-service bot
pushed a commit
that referenced
this issue
Nov 19, 2021
#684 PiperOrigin-RevId: 411136606
This is fixed now: the formatter didn't support pattern matching in switches on Java 17 at all, and there was a separate issue specifically about unused imports. Thanks for the report! |
fawind
pushed a commit
to palantir/palantir-java-format
that referenced
this issue
Jan 7, 2022
google/google-java-format#684 PiperOrigin-RevId: 411136606
fawind
pushed a commit
to palantir/palantir-java-format
that referenced
this issue
Jan 7, 2022
for AST changes in Java 17, in particular the addition of CaseTree#getLabels, which returns a single `DefaultCaseLabelTree` to represent the default case. google/google-java-format#683 google/google-java-format#684 PiperOrigin-RevId: 411146137
fawind
pushed a commit
to palantir/palantir-java-format
that referenced
this issue
Jan 10, 2022
google/google-java-format#684 PiperOrigin-RevId: 411136606
fawind
pushed a commit
to palantir/palantir-java-format
that referenced
this issue
Jan 10, 2022
for AST changes in Java 17, in particular the addition of CaseTree#getLabels, which returns a single `DefaultCaseLabelTree` to represent the default case. google/google-java-format#683 google/google-java-format#684 PiperOrigin-RevId: 411146137
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With version
1.12.0
google-java-format
does not properly recognize imports utilized only during pattern matched switches.As an example, for the following hierarchy
and a Java file using this hierarchy with a pattern matched switch
google-java-format
will flagimport example.model.TypeA
andimport example.model.TypeB
as unused and candidates for removal.I've recreated this bug in a small repo that illustrates the issue.
The text was updated successfully, but these errors were encountered: