Your source code can contain various annotations. For example, @Nullable and @NotNull
annotations are used, when IntelliJ IDEA supposes that a certain element can become Null.
The @NonNls annotation is used to ignore the hard-coded string literals.
- Make sure that
annotations.jarthat can be found in thelibfolder under the IntelliJ IDEA installation, is added to the module dependencies.For
@javax.annotation.ParametersAreNonnullByDefaultannotations,javaxshould be added to the module libraries.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, @NotNull and @Contract annotations in the Inspections page of the Preferences dialog (Constant conditions and exceptions - Configure annotations).
- Introduce the desired annotation before the package/class/field/variable/method/method parameter declaration.