mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
disable constant value warnings in complex assignments (IDEA-111478)
This commit is contained in:
+2
-1
@@ -1673,7 +1673,8 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
addInstruction(expression.resolve() instanceof PsiField ? new FieldReferenceInstruction(expression, null) : new PopInstruction());
|
||||
}
|
||||
|
||||
addInstruction(new PushInstruction(getExpressionDfaValue(expression), expression, PsiUtil.isAccessedForReading(expression)));
|
||||
boolean referenceRead = PsiUtil.isAccessedForReading(expression) && !PsiUtil.isAccessedForWriting(expression);
|
||||
addInstruction(new PushInstruction(getExpressionDfaValue(expression), expression, referenceRead));
|
||||
|
||||
finishElement(expression);
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
void foo() {
|
||||
int x = 42;
|
||||
<caret>x += 100;
|
||||
}
|
||||
}
|
||||
@@ -175,6 +175,11 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
|
||||
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 }");
|
||||
doTestReplaceConstantReferences();
|
||||
assertEmpty(myFixture.filterAvailableIntentions("Replace with"));
|
||||
}
|
||||
public void testReportConstantReferences_Switch() { doTestReplaceConstantReferences(); }
|
||||
|
||||
public void testCheckFieldInitializers() {
|
||||
|
||||
Reference in New Issue
Block a user