Hey guys,
I am using SonarQube 9.9.3. I get a possibly false positive with Java:
public final class ModuleTestContext {
@Getter(lazy = true)
private static final ModuleTestContext INSTANCE = initialize();
/**
* Constructor.
*/
private ModuleTestContext() {
}
private void shutdown() {
}
private static ModuleTestContext initialize() {
ModuleTestContext instance = new ModuleTestContext();
//use shutdown hook to make sure it is executed once at the end of all tests
Runtime.getRuntime().addShutdownHook(new Thread(instance::shutdown));
return instance;
}
}
Redundant nullcheck of actualValue, which is known to be non-null in ModuleTestContext.getINSTANCE()
findbugs:RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
I am not sure if this might be valid for the Lombok generated code. But I assume Lombok annotations should be ignored in the ruleset?
The upgrade to SonarQube 9.9.3 made the issue appear for us. Before Sonarqube didn’t raise this.
Thanks,
Jens