dfa: don't suggest to replace reference qualifiers with null

This commit is contained in:
peter
2014-04-09 12:56:20 +02:00
parent 73850cbd73
commit 7ddbfd5eed
3 changed files with 13 additions and 1 deletions
@@ -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>;
}
}
}
@@ -16,4 +16,10 @@ class Test {
return foo;
}
public void testDontReplaceQualifierWithNull(Object bar) {
if (bar == null) {
bar.hashCode();
}
}
}