Files
openide/java/java-tests/testData/inspection/dataFlow/fixture/BooleanOrEquals.java
Tagir Valeev c4fee89a6e [java-dfa] IDEA-307630 Constant values: remove warning at the beginning of |= and &= series
GitOrigin-RevId: 3841398346bfc13b26cd6bed05e51e762e2f78e1
2022-12-05 15:06:26 +00:00

22 lines
785 B
Java

// IDEA-304296
class BooleanOrEquals {
boolean test() {
boolean result = false;
result |= check1();
result |= check2();
result |= check3();
return result;
}
boolean testWrong() {
boolean result = true;
<warning descr="Condition 'result' at the left side of assignment expression is always 'true'. Can be simplified">result</warning> |= check1();
<warning descr="Condition 'result' at the left side of assignment expression is always 'true'. Can be simplified">result</warning> |= check2();
<warning descr="Condition 'result' at the left side of assignment expression is always 'true'. Can be simplified">result</warning> |= check3();
return result;
}
native boolean check1();
native boolean check2();
native boolean check3();
}