Hi, I think the rule RSPEC-3065 should detect final fields from out class.
Please refer to the following minimized sample and this is a false negative. SonarQube should report a warning at line 6 because the Min
and Max
used in combination here always return same value and this is wrong result.
class Util {
public static final int UPPER = 20;
public static final int LOWER = 0;
}
public int foo(int num) {
int result = Math.min(Util.LOWER, num); // should report a warning here, but no warnings
return Math.max(Util.UPPER, result);
}
- My Version
- sonarqube-9.2.2.50622
- sonar-scanner-cli-4.6.2.2472-linux