mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
More on comparison that is always false due to being out of type range on implicit type conversion (IDEA-124210)
This commit is contained in:
+4
-2
@@ -470,10 +470,12 @@ public class StandardInstructionVisitor extends InstructionVisitor {
|
||||
}
|
||||
|
||||
if (opSign == LT && constantValue <= minValue) return alwaysFalse(instruction, runner, memState);
|
||||
if ((opSign == LT || opSign == LE) && constantValue > maxValue) return alwaysTrue(instruction, runner, memState);
|
||||
if (opSign == LT && constantValue > maxValue) return alwaysTrue(instruction, runner, memState);
|
||||
if (opSign == LE && constantValue >= maxValue) return alwaysTrue(instruction, runner, memState);
|
||||
|
||||
if (opSign == GT && constantValue >= maxValue) return alwaysFalse(instruction, runner, memState);
|
||||
if ((opSign == GT || opSign == GE) && constantValue < minValue) return alwaysTrue(instruction, runner, memState);
|
||||
if (opSign == GT && constantValue < minValue) return alwaysTrue(instruction, runner, memState);
|
||||
if (opSign == GE && constantValue <= minValue) return alwaysTrue(instruction, runner, memState);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -16,4 +16,10 @@ class Foo {
|
||||
boolean a = <warning descr="Condition 'i < 0x80000000L' is always 'true'">i < 0x80000000L</warning>;
|
||||
boolean f = <warning descr="Condition 'i > 0x7fffffff' is always 'false'">i > 0x7fffffff</warning>;
|
||||
}
|
||||
|
||||
void f(int k) {
|
||||
if (<warning descr="Condition 'k <= Integer.MAX_VALUE' is always 'true'">k <= Integer.MAX_VALUE</warning>);
|
||||
if (<warning descr="Condition 'k > Integer.MAX_VALUE' is always 'false'">k > Integer.MAX_VALUE</warning>);
|
||||
if (<warning descr="Condition 'k >= Integer.MIN_VALUE' is always 'true'">k >= Integer.MIN_VALUE</warning>);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user