Java inspection: Returned back RemoveRedundantElseAction intention, because it turns out it's useful in some cases (IDEA-157727)

This commit is contained in:
Pavel Dolgov
2016-07-20 18:50:32 +03:00
parent ec05aa8b85
commit b525e80a87
10 changed files with 229 additions and 0 deletions
@@ -0,0 +1,13 @@
// "Remove redundant 'else'" "true"
class a {
void foo() {
int a = 0;
int b = 0;
if (a != b) {
return;
}
a = b;
a++;
}
}
@@ -0,0 +1,14 @@
// "Remove redundant 'else'" "true"
class a {
void foo() {
int a = 0;
int b = 0;
if (a != b) {
return;
} e<caret>lse {
a = b;
}
a++;
}
}
@@ -0,0 +1,15 @@
// "Remove redundant 'else'" "false"
import java.io.IOException;
class a {
void foo(boolean condition) throws IOException{
if (condition) {
tMethod();
}
e<caret>lse {
System.out.println("else");
}
}
void tMethod() throws IOException {}
}
@@ -0,0 +1,17 @@
// "Remove redundant 'else'" "false"
class a {
void foo() {
int a = 0;
int b = 0;
if (a != b) {
a = 10;
} else if (a + 1 == b) {
return;
}
e<caret>lse {
a = b;
}
a++;
}
}