invert if: ensure outer if becomes braces when nested if has no else brunch (IDEA-206882)

This commit is contained in:
Anna.Kozlova
2019-02-07 16:49:03 +01:00
parent d5ac0d1f81
commit b6f6bae31a
3 changed files with 31 additions and 1 deletions
@@ -0,0 +1,13 @@
// "Invert 'if' condition" "true"
class Main {
void foo(boolean a1, boolean b1){
if (a1) {
if (!b1) {
System.out.println("1");
}
}
else {
System.out.println("2");
}
}
}
@@ -0,0 +1,13 @@
// "Invert 'if' condition" "true"
class Main {
void foo(boolean a1, boolean b1){
if (a1)
if (b<caret>1) {
} else {
System.out.println("1");
}
else {
System.out.println("2");
}
}
}