Hi Sonarqube Team,
The code below seems to contain the bug described in RSPEC-2637, however, the bug was not being detected during the scan. Any thoughts?
import javax.annotation.Nonnull;
class BugDemo {
@Nonnull
private String primary;
private String secondary;
public BugDemo(String color) {
if (color != null) {
secondary = null;
}
primary = color;
}
public BugDemo() {
}
@Nonnull
public String indirectMix() {
String mix = null;
return mix;
}
public void showBug(String color) {
BugDemo instance1 = new BugDemo(color);
BugDemo instance2 = new BugDemo();
String result = instance1.indirectMix();
System.out.println("Result from indirectMix: " + result);
}
}
Sonarqube version 25.5
Lang: Java
SonarScanner version: 5.0.1.3006
Screenshot of code scan results
