Java: Fixed false positive unused declarations under constant conditions (IDEA-182738)

This commit is contained in:
Pavel Dolgov
2018-10-15 16:15:54 +03:00
parent d606c680c3
commit aa042c4eaa
3 changed files with 10 additions and 1 deletions
@@ -146,7 +146,7 @@ public class DefUseUtil {
ControlFlow flow;
try {
flow = ControlFlowFactory.getInstance(body.getProject()).getControlFlow(body, ourPolicy);
flow = ControlFlowFactory.getInstance(body.getProject()).getControlFlow(body, ourPolicy, false);
}
catch (AnalysisCanceledException e) {
return null;
@@ -0,0 +1,8 @@
class C {
void foo(int n) {
if (false) {
int[] a = new int[n];
a[0] = 1;
}
}
}
@@ -69,6 +69,7 @@ public class DefUseTest extends LightCodeInsightFixtureTestCase {
}
public void testFieldInitializerUsedInMethodReference() { doTest(); }
public void testFieldInitializerChainedConstructor() { doTest(); }
public void testUnderAlwaysFalseCondition() { doTest(); }
@NotNull
@Override