Hi, I found a false negative in SonarQube 26.7.0 with sonar-java 8.34 when reversed bounds are passed to the double overloads of Math.max and Math.min.
Affected tool
SonarQube 26.7.0.124771; sonar-java 8.34 (build 44906)
Affected checker
SonarQube java:S3065
Minimal reproducer
class SpotbugsSonarqubeS3065FloatingPointMinMax {
double clamp(double value) {
return Math.max(1.0, Math.min(0.0, value));
}
}
Reproduction command
sonar-scanner --version
sonar-scanner -Dsonar.projectKey=spotbugs-sonarqube-reproducer -Dsonar.sources=spotbugs-sonarqube-s3065-fn-floating-point-min-max.java -Dsonar.host.url="$SONAR_HOST_URL" -Dsonar.token="$SONAR_TOKEN"
Current behavior
SonarQube produces no java:S3065 diagnostic.
Expected behavior
SonarQube should report java:S3065 at line 3 because the min/max bounds are reversed. For every non-NaN input, the expression evaluates to 1.0 (and NaN propagates for a NaN input).