Hi Team,
The expected SonarQube bug appears not to be caught in the code below, even though it’s caught in a very similar code as seen in the screenshot. Any thoughts?
class BuggyClass {
private int x;
private int y;
public void setX(int val) {
while(getUnreachableCondition()) {}
this.y = val;
}
public int getY() {
while(getUnreachableCondition()) {}
return this.x;
}
public void showBug() {
setX(5);
System.out.println("Expected x to be 5, but got: " + x);
System.out.println("Expected y to be 5, but got: " + getY());
}
private boolean getUnreachableCondition() {
return false;
}
}
Sonarqube version 25.5
Lang: Java
SonarScanner version: 5.0.1.3006
Screenshot of code scan results
