Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convertSwitchToIf/afterDefaultMiddle.java
Tagir Valeev 625c1cc676 ConvertSwitchToIfIntention: fixes after review IDEA-CR-37311:
1. Do not suggest intention if `default` case is not the last one and fallthrough is possible into or out of that case
2. Generate a code-block if side-effect should be extracted to variable
2018-09-27 10:17:10 +07:00

12 lines
262 B
Java

// "Replace 'switch' with 'if'" "true"
class X {
void m(String s) {
if ("foo".equals(s)) {
System.out.println(1);
} else if ("bar".equals(s)) {
System.out.println(3);
} else {
System.out.println(2);
}
}
}