IntelliJ IDEA 2018.1 Help

Inferring Nullity

Annotating automatically nullable and non-null elements

IntelliJ IDEA makes it possible to analyse the source code for the elements that can become null, and annotate them, provided that annotations are available in the project sources.

To automatically annotate nullable and non-null elements

Make sure that annotations.jar is added to your project. If it is not the case, IntelliJ IDEA will suggest to configure the annotations first. This can be done either manually (File | Settings | Project Settings - Inspections - Probable bugs - Constant conditions and exceptions), or automatically.