Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convertSwitchToIf/afterPatternCheck.java
Tagir Valeev 8560c6a5d1 [java-inspections] More preview tests
GitOrigin-RevId: 571a82f66623887c1b5008963df842b2597c58c9
2022-07-27 10:00:31 +00:00

18 lines
581 B
Java

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