Hi,
I'm using Sonar java plugin v4.15.0.12310, and this code below triggers several warnings:
public static void main(final String[] args) {
boolean c1 = false;
boolean c2 = false;
boolean c3 = false;
boolean c4 = false;
for (int i = 0; i < 10; i++) {
if (!c1 && i < 10) {
c1 = true;
} else if (c1 && !c2) {
c2 = true;
} else if (c1 && c2 && !c3) { // says C2 always true and !c3 always true
c3 = true;
} else if (c1 && c2 && c3) { // says c1 is always false
c4 = true;
System.out.println(i);
break;
}
}
if (c1 && c2 && c3 && c4) { // says c3 is always false
System.out.println("All is true");
}
This code indeed displays the message "All is true", proving that the warnings are false.
Is this a known bug?
Thanks,
Didier