mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
LongRangeSet.RangeSet#plus: convert to simple range if number of sets exceeds 3
Fixes IDEA-193987 IDE freeze when turn on code inspection data flow for Java
This commit is contained in:
+3
@@ -1256,6 +1256,9 @@ public abstract class LongRangeSet {
|
||||
@NotNull
|
||||
@Override
|
||||
public LongRangeSet plus(LongRangeSet other, boolean isLong) {
|
||||
if (myRanges.length > 6) {
|
||||
return range(min(), max()).plus(other, isLong);
|
||||
}
|
||||
LongRangeSet result = empty();
|
||||
for (int i = 0; i < myRanges.length; i += 2) {
|
||||
result = result.union(range(myRanges[i], myRanges[i + 1]).plus(other, isLong));
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
native boolean get();
|
||||
|
||||
void test() {
|
||||
int x = get() ? 0 : 1<<30;
|
||||
x = x + (get() ? 0 : 1<<29);
|
||||
x = x + (get() ? 0 : 1<<28);
|
||||
x = x + (get() ? 0 : 1<<27);
|
||||
x = x + (get() ? 0 : 1<<26);
|
||||
x = x + (get() ? 0 : 1<<25);
|
||||
x = x + (get() ? 0 : 1<<24);
|
||||
x = x + (get() ? 0 : 1<<23);
|
||||
x = x + (get() ? 0 : 1<<22);
|
||||
x = x + (get() ? 0 : 1<<21);
|
||||
x = x + (get() ? 0 : 1<<20);
|
||||
x = x + (get() ? 0 : 1<<19);
|
||||
x = x + (get() ? 0 : 1<<18);
|
||||
x = x + (get() ? 0 : 1<<17);
|
||||
|
||||
if (<warning descr="Condition 'x < 0' is always 'false'">x < 0</warning>) {
|
||||
System.out.println("Impossible");
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -62,4 +62,6 @@ public class DataFlowRangeAnalysisTest extends DataFlowInspectionTestCase {
|
||||
|
||||
public void testLongRangePlusMinus() { doTest(); }
|
||||
public void testFebruary31() { doTest(); }
|
||||
|
||||
public void testManyAdditionsDoNotCauseExponentialBlowUp() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user