-
Notifications
You must be signed in to change notification settings - Fork 863
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
Google Java Format fails on complex switch expressions with Java 21 #983
Labels
Comments
After the fixes in 430ba3b and b86c508, the formatter handles this code: class T {
boolean f(Object obj1, Object obj2) {
return switch (obj1) {
case null -> obj2 == null;
case T1 myT1 when obj2 instanceof T1 otherT1 -> myT1.equalsStrict(otherT1);
// exception ^ at the when (69:46 in the original source)
case T2 myT2 when obj2 instanceof T2 otherT2 -> T2.isDeepEquals(myT2, otherT2);
default -> obj1.equals(obj2);
};
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version 1.18.1 formatter throws an exception when trying to handle code like this:
The exception is:
The text was updated successfully, but these errors were encountered: