diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java index 9090751539e8..49b201eed97b 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java @@ -169,7 +169,7 @@ public class StandardInstructionVisitor extends InstructionVisitor { DfaValue dfaValue = instruction.getValue(); if (dfaValue instanceof DfaVariableValue) { DfaConstValue constValue = memState.getConstantValue((DfaVariableValue)dfaValue); - myPossibleVariableValues.putValue(instruction, constValue != null ? constValue : ANY_VALUE); + myPossibleVariableValues.putValue(instruction, constValue != null && (constValue.getValue() == null || constValue.getValue() instanceof Boolean) ? constValue : ANY_VALUE); } } return super.visitPush(instruction, runner, memState); diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java index 74cbba71ac53..1358d4d36457 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java @@ -161,28 +161,27 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase { myFixture.testHighlighting(true, false, true, getTestName(false) + ".java"); } - public void testReportConstantReferences_ReplaceWithString() { + public void _testReportConstantReferences_ReplaceWithString() { doTestReportConstantReferences(); myFixture.launchAction(myFixture.findSingleIntention("Replace with 'CONST'")); myFixture.checkResultByFile(getTestName(false) + "_after.java"); } - public void testReportConstantReferences_ReplaceWithIntConstant() { + public void _testReportConstantReferences_ReplaceWithIntConstant() { doTestReportConstantReferences(); myFixture.launchAction(myFixture.findSingleIntention("Replace with 'CONST'")); myFixture.checkResultByFile(getTestName(false) + "_after.java"); } - public void testReportConstantReferences_ReplaceWithEnum() { + public void _testReportConstantReferences_ReplaceWithEnum() { myFixture.addClass("package foo; public enum MyEnum { FOO }"); doTestReportConstantReferences(); myFixture.launchAction(myFixture.findSingleIntention("Replace with 'FOO'")); myFixture.checkResultByFile(getTestName(false) + "_after.java"); } - public void testReportConstantReferences_NotInComplexAssignment() { - myFixture.addClass("package foo; public enum MyEnum { FOO }"); + public void _testReportConstantReferences_NotInComplexAssignment() { doTestReportConstantReferences(); assertEmpty(myFixture.filterAvailableIntentions("Replace with")); } - public void testReportConstantReferences_Switch() { doTestReportConstantReferences(); } + public void _testReportConstantReferences_Switch() { doTestReportConstantReferences(); } public void testCheckFieldInitializers() { doTest();