Hi team, case null, default -> is a common pattern in switch expressions (explicit null is required for compatibility with older switch statements). But it crashes the formatter, e.g. the code below results in /YourFile.java: com.palantir.javaformat.java.FormatterException: 48:13: error: expected token: 'default'; generated - instead -> [Help 1]
public void onReceive(Object message) {
switch (message) {
//...
case null, default -> super.unhandled(message);
}
}
Splitting the case into two separated cases with identical bodies helps, but it's obviously a subpar workaround because it causes static analyzer warnings + prevents switching to palantir-java-formatter without migrating all affected switches in the codebase first.
Hi team,
case null, default ->
is a common pattern in switch expressions (explicit null is required for compatibility with older switch statements). But it crashes the formatter, e.g. the code below results in/YourFile.java: com.palantir.javaformat.java.FormatterException: 48:13: error: expected token: 'default'; generated - instead -> [Help 1]
Splitting the case into two separated cases with identical bodies helps, but it's obviously a subpar workaround because it causes static analyzer warnings + prevents switching to palantir-java-formatter without migrating all affected switches in the codebase first.
Thanks !