mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix false NPE alarms on fields
This commit is contained in:
@@ -59,7 +59,7 @@ public class DfaVariableState implements Cloneable {
|
||||
}
|
||||
|
||||
List<PsiExpression> initializers = NullableStuffInspection.findAllConstructorInitializers((PsiField)var);
|
||||
if (!nullable && initializers.isEmpty()) {
|
||||
if (initializers.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class DfaVariableState implements Cloneable {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return !nullable;
|
||||
}
|
||||
|
||||
protected DfaVariableState(final DfaVariableState toClone) {
|
||||
|
||||
+10
-1
@@ -1,15 +1,24 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.Object;
|
||||
|
||||
public class Doo {
|
||||
private final Object myA;
|
||||
private final Object myB;
|
||||
private final Object myC;
|
||||
|
||||
public Doo(@Nullable Object myA, @NotNull Object myB) {
|
||||
public Doo(@Nullable Object myA, @NotNull Object myB, Object c) {
|
||||
this.myA = myA;
|
||||
this.myB = myB;
|
||||
myC = c;
|
||||
}
|
||||
|
||||
int bar() {
|
||||
return myC.hashCode();
|
||||
}
|
||||
|
||||
|
||||
int foo() {
|
||||
if (<warning descr="Condition 'myB != null' is always 'true'">myB != null</warning> &&
|
||||
<warning descr="Method invocation 'myA.equals(myB)' may produce 'java.lang.NullPointerException'">myA.equals(myB)</warning>) {
|
||||
|
||||
Reference in New Issue
Block a user