blob: 7339d4c5f67730521a12b09d59648f97dcffdaf9 [file]
public class AndAssign {
public void foo(boolean result, Object acc) {
result &= verify(result ? acc : null);
}
public boolean verify(Object o) {
System.out.println(o);
return true;
}
public void positives() {
boolean t = true;
boolean f = false;
boolean r;
r = t;
<warning descr="Condition 'r' at the left side of assignment expression is always 'true'. Can be simplified">r</warning> &= t; // Always true
if (<warning descr="Condition 'r' is always 'true'">r</warning>) { // Always true
System.out.println("foo");
}
r = t;
<warning descr="Condition 'r' at the left side of assignment expression is always 'true'. Can be simplified">r</warning> &= f; // Always true
if (<warning descr="Condition 'r' is always 'false'">r</warning>) { // Always false
System.out.println("foo");
}
r = f;
<warning descr="Condition 'r' at the left side of assignment expression is always 'false'. Can be simplified">r</warning> &= t; // Always false
if (<warning descr="Condition 'r' is always 'false'">r</warning>) { // Always false
System.out.println("foo");
}
r = f;
<warning descr="Condition 'r' at the left side of assignment expression is always 'false'. Can be simplified">r</warning> &= f; // Always false
if (<warning descr="Condition 'r' is always 'false'">r</warning>) { // Always false
System.out.println("foo");
}
r = t;
<warning descr="Condition 'r' at the left side of assignment expression is always 'true'. Can be simplified">r</warning> |= t<error descr="';' expected"> </error> // Always true
if (<warning descr="Condition 'r' is always 'true'">r</warning>) { // Always true
System.out.println("foo");
}
r = t;
<warning descr="Condition 'r' at the left side of assignment expression is always 'true'. Can be simplified">r</warning> |= f<error descr="';' expected"> </error> // Always true
if (<warning descr="Condition 'r' is always 'true'">r</warning>) { // Always true
System.out.println("foo");
}
r = f;
<warning descr="Condition 'r' at the left side of assignment expression is always 'false'. Can be simplified">r</warning> |= t<error descr="';' expected"> </error> // Always false
if (<warning descr="Condition 'r' is always 'true'">r</warning>) { // Always true
System.out.println("foo");
}
r = f;
<warning descr="Condition 'r' at the left side of assignment expression is always 'false'. Can be simplified">r</warning> |= f<error descr="';' expected"> </error> // Always false
if (<warning descr="Condition 'r' is always 'false'">r</warning>) { // Always false
System.out.println("foo");
}
}
}