On SonarCloud, SonarJava raises false positives when using Lombok @UtilityClass
, which (among other things) automatically makes all fields static
:
import lombok.experimental.UtilityClass;
@UtilityClass
public class SomeConstants
{
// S1170: Make this final field static too.
// S00116: Rename this field "MY_CONSTANT" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.
public final int MY_CONSTANT = 123;
}
I have prepared a patch for this and will create a PR shortly.