Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convertSwitchToIf/beforePatternCheck.java
Alexandr Suhinin 35d2aba047 IDEA-270441 convert switch to if: support patterns and null
GitOrigin-RevId: 06cdce2583774907fc263b85fdd85624778fccdf
2021-07-19 15:25:40 +00:00

15 lines
475 B
Java

// "Replace 'switch' with 'if'" "true"
abstract class Test {
abstract Object getObject();
void foo(Object o) {
<caret>switch (o) {
case null, String s -> System.out.println("one");
case ((Integer i) && (i > 0)) -> System.out.println("two");
case /*1*/Float/*2*/ /*3*/f && f/*4*/ > 5 && f < 10 -> System.out.println("two");
case Character c -> System.out.println(c);
case Double c -> System.out.println();
default -> {}
}
}
}