Hi, I found a false negative about the rule RSPEC-2225. Please review the minimized sample below.
I think SonarQube should have reported a waring at line 4 because this function returns a null
String here, but no warnings. Thanks for your kind consideration.
public String toString() {
String str = null;
while(true) {
return str; // should report a warning here, but no warnings
}
}
However, the following case can be detected and these two cases are equivalent.
public String toString() {
String str = null;
for(; true;) {
return str; // Here, this line can be detected
}
}
Used Version:
- sonarqube-9.2.3.50713
- sonar-scanner-4.6.2.2472-macosx