Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingPatternsInSwitch/SwitchExhaustivenessForEnumsWithSealedClassesIn21Java.java
Mikhail Pyltsin 07a6f3f57a [java-highlighting] IDEA-324314 Enums must be qualified with switch with compatible types
GitOrigin-RevId: db218b31e81d767fff0c341a00593983522564b1
2023-07-13 13:29:07 +00:00

49 lines
1.0 KiB
Java

import java.util.Optional;
class Main {
interface IT {
}
sealed interface IT2 {
}
enum T implements IT, IT2 {
A, B, C;
public void test2(IT2 t2) {
switch (t2) {
case T.A -> System.out.println("1");
case B -> System.out.println("2");
case T.C -> System.out.println("3");
}
}
}
public static void main(String[] args) {
}
public void test0(IT2 t2) {
switch (t2) {
case T.A -> System.out.println(1);
case T.B -> System.out.println(2);
case T.C -> System.out.println(3);
}
}
public void test1(IT t2) {
switch (<error descr="'switch' statement does not cover all possible input values">t2</error>) {
case T.A -> System.out.println(1);
case T.B -> System.out.println(2);
case T.C -> System.out.println(3);
}
}
public void test2(IT t2) {
switch (t2) {
case T.A -> System.out.println("1");
case <error descr="Cannot resolve symbol 'B'">B</error> -> System.out.println("2");
case T.C -> System.out.println("3");
}
}
}