- Make sure that annotations.jar that can be found in the lib folder under the IntelliJ IDEA installation, is added to the module dependencies.
You can also use annotations from JSR-305 and FindBugs. In this case, make sure they are added to the classpath.
You can configure @Nullable and @NotNull annotations in the Inspections page of the Settings dialog (Constant conditions and exceptions - Configure annotations).
- Introduce the desired annotation before the package/class/field/variable/method/method parameter declaration.