Hi, I found a false negative in SonarQube 26.7.0 with sonar-java 8.34 when an array-returning method selects null in a conditional expression.
Affected tool
SonarQube 26.7.0.124771; sonar-java 8.34 (build 44906)
Affected checker
SonarQube java:S1168
Minimal reproducer
class SpotbugsSonarqubeS1168ConditionalNullArray {
int[] values(boolean present) {
return present ? new int[] {1} : null;
}
}
Reproduction command
sonar-scanner --version
sonar-scanner -Dsonar.projectKey=spotbugs-sonarqube-reproducer -Dsonar.sources=spotbugs-sonarqube-s1168-fn-conditional-null-array.java -Dsonar.host.url="$SONAR_HOST_URL" -Dsonar.token="$SONAR_TOKEN"
Current behavior
SonarQube produces no java:S1168 diagnostic.
Expected behavior
SonarQube should report java:S1168 at line 3 because one result of the conditional expression is null instead of an empty array.