mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
dfa: fix too complex assertTrue (added state defensive copying)
This commit is contained in:
+3
-1
@@ -254,7 +254,9 @@ public class StandardInstructionVisitor extends InstructionVisitor {
|
||||
DfaValue condition = factory.getRelationFactory().createRelation(argValue, expectedValue, EQEQ, invertCondition);
|
||||
if (condition == null) {
|
||||
if (!(argValue instanceof DfaConstValue)) {
|
||||
falseStates.addAll(states);
|
||||
for (DfaMemoryState state : states) {
|
||||
falseStates.add(state.createCopy());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
condition = constFactory.createFromValue((argValue == expectedValue) != invertCondition, PsiType.BOOLEAN, null);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
abstract class Some {
|
||||
@Contract("_,false->fail")
|
||||
abstract void assertTrue(String s, boolean b);
|
||||
|
||||
void assertContainsAllVariants(List<String> actualVariants, String... expectedVariants) {
|
||||
for (String expectedVariant : expectedVariants) {
|
||||
assertTrue(expectedVariant, actualVariants.contains(expectedVariant));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -235,6 +235,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testManySequentialInstanceofsNotComplex() { doTest(); }
|
||||
public void testLongDisjunctionsNotComplex() { doTest(); }
|
||||
public void testWhileNotComplex() { doTest(); }
|
||||
public void testAssertTrueNotComplex() { doTest(); }
|
||||
public void testManyDisjunctiveFieldAssignmentsInLoopNotComplex() { doTest(); }
|
||||
public void testManyContinuesNotComplex() { doTest(); }
|
||||
public void testFinallyNotComplex() { doTest(); }
|
||||
|
||||
Reference in New Issue
Block a user