Hi there,
We have found a false positive that is reported on a loop variable:
public class FalsePositive {
protected StringBuilder foo() {
String[] array = {"one", "two", "three"};
for (int i = 0; i < array.length; i++) {
for (int j=0;j<=i;j++) {
if(j>0) {
// j can be zero in the first iteration
}
}
}
return null;
}
}
Here Sonar claims that j>0 is always false but it is not on the first iteration of both loops.
Versions:
- Sonar version 6.7.1 (build 35068)
- SonarJava 51 (build 13090)
- Sonarlint for Eclipse 3.3.1.201712071600
Philippe