Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3579

FP in S1170 when class is annotated with @lombok.Builder and field with @Default

    XMLWordPrintable

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.10
    • Component/s: Rules
    • Labels:

      Description

      @Data
      @Builder
      public class MyEntity {
        @Default
        final boolean byDefaultTrue = true; // FP
      }
      

      @lombok.Builder documentation.

      When a field is annotated with @lombok.Default the value is used only as a fallback for its Builder but it can also be initialized inside the Builder class. It is therefore not possible to make it static.

      We should update the Lombok filer to support this case.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              quentin.jaquier Quentin Jaquier
              Reporter:
              quentin.jaquier Quentin Jaquier
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: