mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-dfa] Fix false-positive at array initialization
GitOrigin-RevId: b36b1373c6f7691af6dd129d80bf250a3d833727
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c47b9c9e4f
commit
3aa97e08fa
+1
-4
@@ -1841,10 +1841,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
if (val instanceof Integer) {
|
||||
int lengthValue = (Integer)val;
|
||||
if (lengthValue > 0 && lengthValue <= MAX_UNROLL_SIZE) {
|
||||
DfaVariableValue var = getTargetVariable(arrayExpression);
|
||||
if (var == null) {
|
||||
var = createTempVariable(type);
|
||||
}
|
||||
DfaVariableValue var = createTempVariable(type);
|
||||
addInstruction(new PushInstruction(var, null, true));
|
||||
addInstruction(new SwapInstruction());
|
||||
addInstruction(new AssignInstruction(null, var));
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
public class InitArrayInConstructor {
|
||||
double[] arr;
|
||||
|
||||
InitArrayInConstructor() {
|
||||
arr = new double[3];
|
||||
}
|
||||
}
|
||||
@@ -698,4 +698,5 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase {
|
||||
public void testBoxedDivisionComparison() { doTest(); }
|
||||
public void testUnknownComparedToNullable() { doTest(); }
|
||||
public void testCastInCatch() { doTest(); }
|
||||
public void testInitArrayInConstructor() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user