fix ControlFlowUtil.canCompleteNormally() regression (IDEA-141259)

This commit is contained in:
Bas Leijdekkers
2017-07-24 19:34:17 +02:00
parent aa515b08a1
commit 8d6551408c
5 changed files with 74 additions and 29 deletions
@@ -0,0 +1,14 @@
// "Replace 'switch' with 'if'" "true"
class X {
void m(String s, int a) throws IOException {
if ("a".equals(s)) {
a();
} else {
d();
}
}
void a() throws IOException { }
void d() throws IOException { }
}
@@ -0,0 +1,17 @@
// "Replace 'switch' with 'if'" "true"
class X {
void test4() throws IOException {
String variable = "abc";
if ("abc".equals(variable)) {
String s1 = "abcd";
} else if ("def".equals(variable)) {
String s1 = "abcd";
myFunction(s1);
} else {
throw new IllegalArgumentException();
}
}
public void myFunction(Object o1) throws IOException {
}
}
@@ -0,0 +1,18 @@
// "Replace 'switch' with 'if'" "true"
class X {
void m(String s, int a) throws IOException {
switch<caret> (s) {
case "a": {
a();
break;
}
default: {
d();
}
}
}
void a() throws IOException { }
void d() throws IOException { }
}
@@ -0,0 +1,22 @@
// "Replace 'switch' with 'if'" "true"
class X {
void test4() throws IOException {
String variable = "abc";
<caret>switch (variable) {
case "abc": {
String s1 = "abcd";
break;
}
case "def": {
String s1 = "abcd";
myFunction(s1);
break;
}
default:
throw new IllegalArgumentException();
}
}
public void myFunction(Object o1) throws IOException {
}
}