False positive with Lombok and @Data : Unused "private" fields should be removed

Need to confirm false positive unused private fields if this issue is already resolved.

Code like this
import lombok.Data;

public class CandidateScheduling {
    private String field10;
    private String field11;

    public static class SomeProps {
        private String field20;
        private String field21;

Generates " Unused “private” fields should be removed "
I confirmed my sonar.java.libraries and .binaries and checked the generated class to have getters, setters and annotations with @Generated

Maybe this is fixed in a newer version of SQ, can anyone confirm this, please?
Also, is there documentation we can reference regarding inline suppression of this issue and others? What would be the suppress statement for this?

Here are the versions in my setup
Sonarqube server Community Edition Version 8.9.8 (build 54436)
Sonarqube Gradle plugin id “org.sonarqube” version ‘’
Gradle 7.4
openjdk version “1.8.0_345”
OpenJDK Runtime Environment (Zulu (build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (Zulu (build 25.345-b01, mixed mode)

Hey there.

This false-positive is addressed in the v9.x series of SonarQube. SonarQube v9.9 LTS came out last week! Sounds like an upgrade is in your future.

I am ignoring this warning now with @SuppressWarnings(“java:S1068”)
Will check it when we upgrade :slight_smile:
Thank you @Colin

1 Like

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