Hi, I found a false negative in SonarQube 26.7.0 with sonar-java 8.41 when a numeric relational loop condition remains true because its operands are never modified.
Affected tool
SonarQube 26.7.0.124771; sonar-java 8.41 (build 47177)
Affected checker
SonarQube java:S2189
Minimal reproducer
class SpotBugsSonarQubeS2189LoopVariable {
void obvious() {
int value = 0;
while (value < 100) {
}
}
}
Reproduction command
sonar-scanner --version
javac -d classes spotbugs-sonarqube-s2189-fn-unmodified-loop-variable.java
sonar-scanner -Dsonar.projectKey=spotbugs-sonarqube-reproducer -Dsonar.sources=spotbugs-sonarqube-s2189-fn-unmodified-loop-variable.java -Dsonar.java.binaries=classes -Dsonar.host.url="$SONAR_HOST_URL" -Dsonar.token="$SONAR_TOKEN"
Current behavior
SonarQube produces no java:S2189 diagnostic.
Expected behavior
SonarQube should report line 4 because value remains zero, making the relational condition permanently true with no reachable loop exit.