I'm using Lombok for generating my POJOs. I've got a bunch of fields annotated with javax.annotation.Nonnull
and I expect this annotation to be transferred to the constructor automatically.
However, this is not happening, Lombok seems to omit this annotation at all and no warning is generated when using @Nullable
value for this field.
When the constructor is generated by IDE - everything works as expected. This also works for getters/setters.
I've tried adding javax.annotation.Nonnull
to lombok.copyableAnnotations
and adding javax.annotation.ParametersAreNonnullByDefault
annotation, all to no avail.
@Data
class TestObject {
@Nonnull private String nonnull;
}
TestObject testObject = new TestObject(null); <-- no warning
testObject.setNonnull(null); <-- warning generated
I expect to receive the same warning on a constructor as I'm getting on a setter. Is that a bug in Lombok, something impossible to achieve, or am I simply missing something?