mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-125194 Strange control-flow inspection
This commit is contained in:
+6
@@ -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 {}");
|
||||
|
||||
Reference in New Issue
Block a user