Chief complaint: Report a false positive for Java:S1118
Desired resolution: Sonar recognizes Lombok’s annotation for private constructor to hide the implicit public one.
I utilize Lombok with my classes to remove the need for setting up boilerplates manually. For utility classes, they are always annotated with @NoArgsConstructor(access = AccessLevel.PRIVATE) and my code keeps getting flagged by Sonar with “Add a private constructor to hide the implicit public one.”
This should not raise the java:S1118 error.
package my.project;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Thing {
public static boolean returnThis() {
return true;
}
}