[英]SonarQube false positive squid:S1450 for @Getter (lombok) annotated fields
I think I have found a false positive while using the @Getter
annotation from Project Lombok . 我想在使用Project Lombok的
@Getter
注释时发现了误报。
In the following example class I got the warning "Private fields only used as local variables in methods should become local variables" ( squid:S1450
). 在下面的示例类中,我收到警告“私有字段仅用作方法中的局部变量应该成为局部变量” (
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 it a bug in the SonarQube rule or is there something wrong with my class or with my understanding of this rule or the
@Getter
annotation? 它是SonarQube规则中的错误还是我的班级或我对此规则或
@Getter
注释的理解有问题?
Just for the sake of completeness: 只是为了完整起见:
@Getter
annotation on class level and I got the same warning. @Getter
注释放在类级别上,我也得到了同样的警告。 I have tested with the following versions: 我测试了以下版本:
You're right and I've created the following Jira ticket https://jira.sonarsource.com/browse/SONARJAVA-1924 . 你是对的,我已经创建了以下的Jira票证https://jira.sonarsource.com/browse/SONARJAVA-1924 。 Thanks for your feedback !
感谢您的反馈意见 !
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.