mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
dfa: don't suggest to replace reference qualifiers with null
This commit is contained in:
+1
-1
@@ -291,7 +291,7 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
|
||||
private static void reportConstantReferenceValues(ProblemsHolder holder, StandardInstructionVisitor visitor, Set<PsiElement> reportedAnchors) {
|
||||
for (Pair<PsiReferenceExpression, DfaConstValue> pair : visitor.getConstantReferenceValues()) {
|
||||
PsiReferenceExpression ref = pair.first;
|
||||
if (!reportedAnchors.add(ref)) {
|
||||
if (ref.getParent() instanceof PsiReferenceExpression || !reportedAnchors.add(ref)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,4 +16,10 @@ class Test {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void testDontReplaceQualifierWithNull(Object bar) {
|
||||
if (bar == null) {
|
||||
<warning descr="Method invocation 'bar.hashCode()' may produce 'java.lang.NullPointerException'">bar.hashCode()</warning>;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -16,4 +16,10 @@ class Test {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void testDontReplaceQualifierWithNull(Object bar) {
|
||||
if (bar == null) {
|
||||
bar.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user