Missing Ctor rule doesn't support lomobk annotations

I have gradle(6.9) springboot(2.7.0) project with following dependecy

compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testCompileOnly 'org.projectlombok:lombok:1.18.22'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'     

while analysis with sonar (version is 8.9) it shows Missing Ctor rule(Class should define a constructor) even if i had used @NoArgsConstructor it shows Class should define a constructor.checked this with AllArgsConstructor too.The same error shows for entity class annotated with @Entity.

I have tried to add the following in sonar-project.properties sonar.java.libraries=project/build/resources/main/META-INF/resources/lombok.jar but not working.

seems that lombok annotations AllArgsConstructor,NoArgsConstructor etc not supported in sonar


Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.9 → 9.9.1 → 10.1 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

If your issue persists after upgrade, please come back to us.

I have tried up gradation but it failed.because am using java 13 version.In order to use the latest version need java 17.Currently java up gradation is not possible.That’s why sticking on this.In detail analysis of class files,found that constructor generated for some classes but still showing the same rule.seems that sonar is not taking that generated code by lombok

given the following in the lombok.config

lombok.addLombokGeneratedAnnotation = true

it will helps only to improve the coverage of @NoArgsConstructor,@Getter etc

I found that .class file having the generated constructor but sonar is not analysing this properly.That sonar rule is from checkstyle:com.puppycrawl.tools.checkstyle.checks.coding.MissingCtorCheck

I can’t suppress this rule.expecting other solutions for this

SonarQube 9.9 LTS requires a Java 17 server runtime, but you can continue to analyze projects of older Java versions.

It won’t be possible to look at this issue until you’re using a supported version of SonarQube.

After so many days of effort, I got the solution.

This will resolved in sonar checkstyle version=“10.12.1”.
I have upgraded the sonar to 10.1 version and checkstyle 10.12.1.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.