Lombok annotation issue "Remove this unused private field" with Community Build v24

Hello Sonar,

Our company uses SonarQube Community Build v24.12.0.100206.

Code below creates the issue Remove this unused "referenceId" private field. as Lombok annotation is not recognized.

import lombok.Data;

@Data
public class XYZ implements EventContent {

  private String referenceId;

}

There are a few topics here on the same issue (e.g [Link] (SonarQube says removed unused private field(lombok)) ) and the solution seems to be to use SonarQube version 10.6 or higher.

Should the issue already be fixed in Community Build v24?
If so, any pointer to why it is not working in our case?

Thank you,
Raluca

Hey @Raluca_Placinta

I canā€™t reproduce this! As soon as I remove the @Data annotation I get the issue (java:S1068), but once I add it back the issue disappears.

How are you analyzing your code? Using the SonarScanner CLI or the Scanner for Maven / Gradle?

I ask because using the SonarScanner CLI often results in the full semantics not being available for analysis (because of invalid bytecode being passed to the scanner due to manual configuration, as opposed to the Scanner for Maven/Gradle which handles it automatically).

This can affect analysis results.

Hey Colin,

That was our problem indeed - switching from SonarScanner CLI to Scanner for Maven solved the false positive issues.

Thank you!

1 Like

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