don't unwrap do-while statement with break/continue inside (IDEA-CR-20896)

This commit is contained in:
peter
2017-05-12 14:21:57 +02:00
parent 90331f7872
commit 514f227143
3 changed files with 35 additions and 4 deletions
@@ -0,0 +1,9 @@
class Test {
public static void test(int b) {
do {
if (b == 1) break;
System.out.println();
} while (<warning descr="Condition is always false">fa<caret>lse</warning>);
}
}
@@ -434,6 +434,10 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
doTest();
checkIntentionResult("Unwrap 'do-while' statement");
}
public void testLiteralDoWhileConditionWithBreak() {
doTest();
assertFalse(myFixture.getAvailableIntentions().stream().anyMatch(i -> i.getText().contains("Unwrap 'do-while' statement")));
}
public void testFalseForConditionNoInitialization() {
doTest();