Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/makeDefaultLastCase/before2.java
Andrey Cherkasov b56985873a [java-highlighting] JEP 432: A 'case null, default' label dominates all other switch labels
A 'default' label dominates a case label with a case pattern, and it also dominates a case label with a 'null' case constant.

IDEA-309549

GitOrigin-RevId: 6877992c530e41a1200ea7c20d6405da4be0324b
2022-12-29 00:57:49 +00:00

11 lines
351 B
Java

// "Make 'default' the last case" "true-preview"
class X {
void test(Object obj) {
switch (obj) {
case null, default -> System.out.println("null or default");
case Integer i -> System.out.println("Integer");
case String s when s.isEmpty()<caret> -> System.out.println("empty String");
}
}
}