IntelliJ IDEA 2017.3 Help

External Annotations

Consider a situation, when one needs to annotate symbols with @Nullable/@NotNull or @NonNls, but to avoid annotations in the source code. This may be the case when a team works on a project, using different IDEs, for example, IntelliJ IDEA and Eclipse; or when working with library classes.

This section provides brief description of external annotations. To learn how to enable, configure and create external annotations, refer to the section Using External Annotation.

IntelliJ IDEA suggests using external annotations that are stored outside of the source code. Information about annotated symbols is stored in XML files, rather than in the source code. Each entry maps a method parameter or return value to the desired annotation class.

Such file has the name annotations.xml and resides in the path that depends on the origin of the specific annotation. If an annotation pertains to the SDK, configured for your project, the path is to be defined in the SDK settings. If an annotation pertains to a module, the path should be defined in the module settings.

Last modified: 6 March 2018

See Also