mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-221312 NPE warning on instance-qualified static method call
GitOrigin-RevId: cb7844ba9cb97413161402fb0ff187d0a5ee7922
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e4d94d10a7
commit
964884225d
+4
@@ -160,6 +160,10 @@ public class NullabilityProblemKind<T extends PsiElement> {
|
||||
}
|
||||
PsiElement parent = context.getParent();
|
||||
if (parent instanceof PsiReferenceExpression) {
|
||||
PsiElement resolved = ((PsiReferenceExpression)parent).resolve();
|
||||
if (resolved instanceof PsiMember && ((PsiMember)resolved).hasModifierProperty(PsiModifier.STATIC)) {
|
||||
return null;
|
||||
}
|
||||
PsiElement grandParent = parent.getParent();
|
||||
if (grandParent instanceof PsiMethodCallExpression) {
|
||||
return callNPE.problem((PsiMethodCallExpression)grandParent, expression);
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Null {
|
||||
public static void greet() {
|
||||
System.out.println("Hello World");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Null null1 = null;
|
||||
null1.greet();
|
||||
}
|
||||
}
|
||||
@@ -666,4 +666,5 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
|
||||
public void testArrayElementLocality() { doTest(); }
|
||||
public void testOverwrittenParameter() { doTest(); }
|
||||
public void testClassCastExceptionDispatch() { doTest(); }
|
||||
public void testInstanceQualifiedStaticMember() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user