S1948 FP on collection fields of serializable class with Lombok @Value

  • What language is this for? Java

  • Which rule? S1948

  • Why do you believe it’s a false-positive/false-negative?
    Lombok @Value makes fields private. The rule raises an issue for collection fields that are not private. The rule misses that the fields are in fact private.

  • Are you using

    • SonarQube - community edition version 10.1
  • How can we reproduce the problem?

@Value
public class Foo implements Serializable {
  Set items; // FP, field is private due to @Value 
  Collection moreItems; // FP
  List otherItems; // FP
} 

Hey @bduderstadt ,

Long time no see! Thanks a lot for the feedback and easy reproducer.
Ticket created: SONARJAVA-4536

Cheers,
Michael

1 Like

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