mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-dfa] Do not drop NULLABLE when updating dependent variables.
Attempt to fix IDEA-336371 False Negative NPE after instanceof check GitOrigin-RevId: 1539e33119f58bcd58f20d9015b7c8092d79d02b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
264309beb4
commit
f2c828e9d8
+21
@@ -0,0 +1,21 @@
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
final class NullFP {
|
||||
void test(@NotNull Y y) {}
|
||||
|
||||
interface X {
|
||||
@Contract(pure = true)
|
||||
@Nullable Y getY();
|
||||
}
|
||||
|
||||
interface Y {}
|
||||
interface Z extends Y {}
|
||||
|
||||
void run(@NotNull final X x) {
|
||||
final Y y = x.getY();
|
||||
if (y instanceof Z) {}
|
||||
test(<warning descr="Argument 'x.getY()' might be null">x.getY()</warning>);
|
||||
}
|
||||
}
|
||||
@@ -734,4 +734,5 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
|
||||
public void testDuplicatedByPointlessBooleanInspection() { doTest(); }
|
||||
public void testSystemOutNullSource() { doTest(); }
|
||||
public void testPrimitiveTypeFieldInWrapper() { doTest(); }
|
||||
public void testNullWarningAfterInstanceofCheck() { doTest(); }
|
||||
}
|
||||
|
||||
+1
-1
@@ -1276,7 +1276,7 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
type = type.fromRelation(RelationType.EQ);
|
||||
for (DfaVariableValue value : eqClass.asList()) {
|
||||
if (value != dfaVar) {
|
||||
recordVariableType(value, type);
|
||||
recordVariableType(value, type.meet(value.getInherentType()));
|
||||
if (!updateQualifierOnEquality(value, value)) return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user