Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/NestedUnrolledLoopNotComplex.java
Tagir Valeev 9daeb1e202 [java-dfa] Widen resulting state on back branches merge
If we are inside short counted loop with disabled backbranches widening, the merging can reset counted loop variable (e.g. replace constant 2 with 0..2 range), resulting in more non-widened iterations than expected. This in turn will produce more states, eventually making the whole analysis too complex.

GitOrigin-RevId: 9eb2145ce233271f9c410e36b2582cc97b5a7f27
2021-09-06 06:28:23 +00:00

21 lines
581 B
Java

import java.util.ArrayList;
public class NestedUnrolledLoopNotComplex {
public static void <weak_warning descr="Method 'main' is complex: data flow results could be imprecise">main</weak_warning>(String[] args) {
ArrayList<Integer> x = new ArrayList<>();
ArrayList<Integer> y = new ArrayList<>();
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
if (contains(i, j)) {
x.add(i);
y.add(j);
}
}
}
if (x.size() < 10) {}
if (y.size() < 10) {}
}
static native boolean contains(int x, int y);
}