mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: Don't reuse cached ControlFlow when the context is not equivalent (IDEA-168768)
This commit is contained in:
@@ -95,7 +95,7 @@ public class ControlFlowFactory {
|
||||
if (enableShortCircuit != this.enableShortCircuit) return false;
|
||||
|
||||
// optimization: when no constant condition were computed, both control flows are the same
|
||||
if (!controlFlow.isConstantConditionOccurred()) return true;
|
||||
if (this.evaluateConstantIfCondition && !controlFlow.isConstantConditionOccurred()) return true;
|
||||
|
||||
return evaluateConstantIfCondition == this.evaluateConstantIfCondition;
|
||||
}
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
public class IDEA168768 {
|
||||
private final boolean b = false;
|
||||
private boolean b2 = false;
|
||||
|
||||
public void m() throws Exception {
|
||||
final long s;
|
||||
if (b) {
|
||||
s = 1;
|
||||
}
|
||||
if (b) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
||||
public void m1() throws Exception {
|
||||
final long s;
|
||||
final boolean b1 = false;
|
||||
if (b1) {
|
||||
s = 1;
|
||||
}
|
||||
if (b1) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
|
||||
public void m2() throws Exception {
|
||||
final long s;
|
||||
if (b2) {
|
||||
s = 1;
|
||||
}
|
||||
if (b2) {
|
||||
System.out.println(<error descr="Variable 's' might not have been initialized">s</error>);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -415,6 +415,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testInnerClassObjectLiteralFromSuperExpression() { doTest(false); }
|
||||
public void testPrivateFieldInSuperClass() { doTest(false); }
|
||||
public void testNoEnclosingInstanceWhenStaticNestedInheritsFromContainingClass() { doTest(false); }
|
||||
public void testIDEA168768() { doTest(false); }
|
||||
|
||||
public void testStaticMethodCalls() {
|
||||
doTestFile(BASE_PATH + "/" + getTestName(false) + ".java").checkSymbolNames().test();
|
||||
|
||||
Reference in New Issue
Block a user