SonarQube false positive squid: S1450 for annotated fields @Getter (lombok)

I think I found a false result using the @Getterannotation from Project Lombok .

In the following class example, I received the warning "Private fields used only as local variables in methods that should become local variables" ( squid:S1450).

public class Example {

    @Getter
    private String exampleField; // <-- squid:S1450

    public Example(final String value) {
        setExampleField(value);
    }

    private void setExampleField(final String exampleField) {
        this.exampleField = exampleField;
    }

}

Can someone confirm this? Is this a mistake in the SonarQube rule or is there something wrong with my class or with my understanding of this rule or annotation @Getter?

For completeness only:

  • Lombok project annotations or created methods are recognized correctly in other SonarQube rules. Therefore, I think my setup is fine.
  • @Getter , .
  • SonarLint ( IntelliJ IDEA) - SonarQube. , .
  • SonarLint pluign IntelliJ IDEA SonarQube, .

:

  • SonarQube 6.0
  • Java SonarQube 4.2
  • SonarLint ( IntelliJ IDEA) 2.3.2
  • IntelliJ IDEA 2016.2.5
  • Java 8
+4

Source: https://habr.com/ru/post/1659613/


All Articles