Infer nullity
The nullability analysis in IntelliJ IDEA can scan your code and add @Nullable
and @NotNull
annotations to your code. The analysis helps you detect contract violations in your code and suggests null checks where possible.
Run the nullability analysis
From the main menu, select
.If you haven't added the library with annotations to the classpath, IntelliJ IDEA will prompt you to download it from Maven.
In the Specify Infer Nullity Scope dialog, select the scope of the analysis. If you want to include test sources and annotate local variables, select the corresponding checkboxes.
Click OK.
IntelliJ IDEA adds import statements for annotations if required, and annotates parameters and variables.
Last modified: 29 November 2022