[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
This commit is contained in:
Andrey Cherkasov
2022-12-29 03:15:03 +04:00
committed by intellij-monorepo-bot
parent 5bc370c995
commit b56985873a
12 changed files with 223 additions and 37 deletions

View File

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