Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/WideningToDouble.java
T
Tagir Valeev ed64e02bee ControlFlowAnalyzer#acceptBinaryRightOperand: properly convert type for comparison
Fixes IDEA-200364 Checking equality between int and double confuses "Constant condition and exception" inspection
2018-10-12 10:12:22 +07:00

16 lines
479 B
Java

class WideningToDouble {
public static void main(String[] args) {
long x = 1L << 54;
double y = x + 1;
boolean trueValue = <warning descr="Condition 'x == y' is always 'true'">x == y</warning>; // ASSIGNMENT
System.out.println(trueValue); // prints "true"
}
void test() {
int y = 2;
if (<warning descr="Condition 'y == 2.1' is always 'false'">y == 2.1</warning>) {
System.out.println("true");
} else
System.out.println("false");
}
}