IDEA-125194 Strange control-flow inspection

This commit is contained in:
peter
2014-05-16 16:51:39 +02:00
parent 0f495ffd43
commit 83a2697042
3 changed files with 19 additions and 0 deletions
@@ -118,6 +118,12 @@ public class StandardInstructionVisitor extends InstructionVisitor {
if (dfaDest instanceof DfaVariableValue) {
DfaVariableValue var = (DfaVariableValue) dfaDest;
DfaValueFactory factory = runner.getFactory();
if (dfaSource instanceof DfaVariableValue && factory.getVarFactory().getAllQualifiedBy(var).contains(dfaSource)) {
dfaSource = factory.createTypeValue(((DfaVariableValue)dfaSource).getVariableType(), ((DfaVariableValue)dfaSource).getInherentNullability());
}
if (var.getInherentNullability() == Nullness.NOT_NULL) {
checkNotNullable(memState, dfaSource, NullabilityProblem.assigningToNotNull, instruction.getRExpression());
}
@@ -0,0 +1,12 @@
class Doo {
void foo(Throwable e) {
Throwable t = e;
while (t.getCause() != null) t = t.getCause();
if (e != t) {
System.out.println();
}
}
}
@@ -322,6 +322,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
public void testNullableBoolean() { doTest(); }
public void testSameComparisonTwice() { doTest(); }
public void testRootThrowableCause() { doTest(); }
public void testParametersAreNonnullByDefault() {
myFixture.addClass("package javax.annotation; public @interface ParametersAreNonnullByDefault {}");