Hi,
A class field is reported to not be initialized while it is.
Versions
- Eclipse IDE
Version: 2020-12 (4.18.0)
Build id: 20201210-1552 - SonarLint
5.6.0.25634 - Lombok
1.18.18
Sample Code
import lombok.NonNull;
import lombok.Setter;
public class S2637FalsePositiveSampleCode {
@Setter
@NonNull
private String foo;
public S2637FalsePositiveSampleCode(String foo) {
setFoo(foo);
}
}
Lombok generates the method setFoo
. Since the field foo
is annotated with @NonNull
, lombok adds a null check in the setFoo
method.
However, an info is raised :
“foo” is marked “lombok.NonNull” but is not initialized in this constructor.