Must-share information (formatted with Markdown):
- which versions are you using:
SonarQube Entreprise Edition v10.6 (92116)
Hello Sonar team,
Looks like we have a false positive with java:S1165 Make this “id” field final when using Lombok annotation.
Here is a reproducer
import lombok.EqualsAndHashCode;
import lombok.Value;
import lombok.experimental.NonFinal;
@Value
@EqualsAndHashCode(callSuper = true)
@NonFinal
public abstract class MyException extends Exception {
private static final long serialVersionUID = 1L;
long id;
protected MyException(long id, String message) {
super(message);
this.id = id;
}
}
On the line long id;
Sonarqube (and SonarLint also) raise the issue Make this “id” field final
In this case the Lombok annotation @Value
guarantees that the field id
is final.
With
Xavier