SonarQube says removed unused private field(lombok)

Hello,

I am using SonarQube version 9.9.4.87374 and employing DOCKER for CI/CD with Git.
(I’m using JAVA 17)
I am encountering an issue where the rule

“java:S1068” Remove this unused private field"

is being triggered in DTO and entity that use the `@Data annotation from Lombok.

I have already added the following line to the lombok.config file:

lombok.addLombokGeneratedAnnotation = true

However, this has not resolved the issue. Could you please advise on how to address this problem?

Thank you.

Hey there.

This false-positive is addressed in the most recent version of SonarQube, v10.6 (SONARJAVA-4933)

You can either:

  • Upgrade to the newest version
  • Mark the issues as false-positive
  • Disable this rule for this project
1 Like