Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/ReduceBinOpOnCast.java
Tagir Valeev c40db04b6c DfaBinOpValue: fix for float/double casts (EA-221317); more tests
GitOrigin-RevId: d9dbe0360a9427cf601eebe0b585fbfc7c45ccd8
2020-01-30 04:13:49 +00:00

30 lines
678 B
Java

import java.util.*;
public class ReduceBinOpOnCast {
// IDEA-231598
private void doByte(byte b) {
System.out.println(b);
if (b < 0) {
<warning descr="Variable update does nothing">b</warning> +=256;
}
System.out.println(b);
}
void test(int a, short b) {
if (a == 0xFFFFF) {
int res = (short)(b + a + 1);
if (<warning descr="Condition 'res == b' is always 'true'">res == b</warning>) {}
}
}
void testTwoChecks(int a, short b) {
if (a == 0x10000 || a == 0x20000 || a == 0) {
<warning descr="Variable update does nothing">b</warning> += a;
}
}
void testDoubleCast(int x) {
double d = x + 1;
}
}