@lombok.Builder.Default

Template for a good false-positive report, formatted with Markdown:

  • SonarQube Version 8.5 (build 37579)
@Data
@Builder
public class MyEntity {
  @Default
  final boolean byDefaultTrue = true;
}

SonaQube report that I should make this static final instead of just final. But Lombok is using the value only as fallback for its Builder and is indeed initializing this field inside the BuilderClass.

Hello @Dirk_Peters and welcome to the SonarSource community!

Makes sense to me, ticket created: SONARJAVA-3579.

Thanks for spotting and reporting this problem.

Best,
Quentin

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