Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/deconstructionAndGuards/SwitchStatement.java
2023-07-05 12:09:22 +00:00

24 lines
572 B
Java

record Sample(int x, int y){}
public class Test {
void test(Object o, Object o2){
switch (o) {
case Sample(int r, int q) when (r<0 ):
System.out.println(r);
break;
case Integer i when o2 instanceof String str:
System.out.println(str);
System.out.println(i);
break;
case Sample(int r, int q):
System.out.println(r);
break;
case String s:
System.out.println(<error descr="Cannot resolve symbol 'r'">r</error>);
System.out.println(s.length());
break;
}
}
}