Lombok, @Value and squid:S2039 "Member variable visibility should be specified"

SonarQube: 8.0, SonarJava: 5.14 (build 18788)

Hi,

when scanning this class:

@Value
public class Item {
    String id;
    String displayName;
}

SonarQube finds 2 issues “squid:S2039 Member variable visibility should be specified”.

Lombok will, as I used @Value, make these fields private and final in the bytecode.

Is there a way to get SonarQube to recognize this?

I already tried setting sonar.java.libraries, to no effect.

1 Like

Hey Moritz,

Thanks for the feedback and reporting this. It is indeed a FP and setting libraries differently should not work. The rule is simply not handling this case.

I created the following ticket to fix it: SONARJAVA-3206

Cheers,
Michael