I’m encountering an issue where the Jakarta `@Nullable` annotation is not being propagated to the setter method generated by Lombok’s `@Data` annotation.
However, when I use the `@Nullable` annotation from `javax`, it works as expected.
Here is a simplified version of my code:
import jakarta.annotation.Nullable;
import lombok.Data;
@Data
public class MyClass {
@Nullable
private String myField;
}
The setter method generated for `myField` does not have the `@Nullable` annotation on its parameter.
If I change the import to `javax.annotation.Nullable`, the `@Nullable` annotation is correctly applied to the setter method’s parameter.
import javax.annotation.Nullable;
import lombok.Data;
@Data public class MyClass {
@Nullable
private String myField;
}
I have ensured that I am using the latest version of Lombok.
Why does this discrepancy exist between Jakarta and `javax` annotations, and how can I get the Jakarta `@Nullable` annotation to work with Lombok-generated setter methods?
1. Ensuring that Lombok is up to date.
2. Checking Lombok configuration settings.