Lombok is a library I like to use in my projects to limit boilerplate code and focus on the core logic of my applications. I am using the IntelliJ plugin to integrate Lombok annotation processing with my IDE, for example to enable auto-completion of methods generated from @Getter/@Setter.
While this works pretty well, I regularly find myself searching resources on how I can configure Intellij to show warnings when I provide a
null value to a method argument annotated with @NonNull. Since a picture is worth a thousand words here is what I try to achieve:
Since I spent some time figuring this out today I'll post my solution here in case anyone is wondering how this can be done (and also as an archive I can retrieve later 😅):
File -> Settings
- Navigate to
Editor -> Inspection -> Java -> Probable bugs -> Nullability problems -> @NotNull/@Nullable problems
- Click on
Configure Annotationsin the right panel
- Rebuild your project
You may have noticed the naming error in the warning pop-up ("@NotNull" instead of "@NonNull"). I didn't look into it, let me know if you have a solution for that!