We're trying to add "Nullaway" (https://github.com/uber/NullAway) to our repo. This is a tool that assumes everything not annotated with @Nullable can't be null and enforces it in compile time.
We also use Lombok, with focus on @Data. Lombok decides which fields to add to the RequiredArgsConstructor based on a @NonNull annotation. Furthermore, Nullaway requires that all constructurs set a value to all the fields not marked as @Nullable.
Our issue is - we don't wish to annotate all fields (both with @Nonnull and @Nullable), as it's redundant. We'd like to have one of them be a "default" (preferably the @Nonnull option).
How can we solve this? An ideal solution would be to configure the RequiredArgsConstructor to treat any field not marked as @Nullable as required, but that option doesn't exist. We're open to any and all creative ideas.
I tried looking for such a configuration in Lombok, which doesn't exist. I also tried annotating at the class level to no avail.
Make a text file and name it
lombok.config. Inside, stick some lines of text. See the documentation of the feature. You can tell lombok about your nullable annotations. You can also tell it to add@Generatedannotations which NullAway understands - thanks to @Sweeper who linked to that section of the NullAway docs in the comments.lombok.config can be in a package, or any parent directory of it; even
//C:\though that'd perhaps be a bit weird. Generally you'd put this either inprojectrootorprojectroot/src.