If you want IntelliJ IDEA to use external annotations, you have to enable this facility, and specify the directories, where the external annotations will be stored.
This section describes how to:
- Enable external annotations.
- Configure paths to the external annotations on the SDK or module level.
- Apply external annotations.
- In the Code Generation section of the Java code style page,
select the check box Use external annotations.

- Apply changes and close the dialog box.
- Open the Project Structure dialog (⌘; or ⌘;⌘; or ⌘;⌘; or ⌘;^ ⇧ ⌥ S, ⌃⌥⇧S or ⌃⌥⇧S^ ⇧ ⌥ S, ⌃⌥⇧S or ⌃⌥⇧S).
- In the Platform Settings section, click SDK.
- In the SDK page, select Annotations tab.
- Click Add button and specify the desired path in the Select Path dialog. You can create as many annotation paths as you like.
- Apply changes and close the dialog box.
- On the context menu of a project, choose . Project Structure dialog is displayed on the Modules page.
- Select Paths tab.
- In the External Annotations section, click Add and specify the desired path in the Select Path dialog. You can create as many annotation paths as required.
- Apply changes and close the dialog box.
Follow these general steps:
- If code inspection alerts you about the necessity to annotate a symbol, press
⌥⏎ or ⌥⏎⌥⏎ or ⌥⏎⌘1 or ⌘1⌥ Enter, ⌥⏎ or ⌥⏎⌥ Enter, ⌥⏎ or ⌥⏎
to show the list of intention actions, and select the
appropriate
Annotate
command, for example:

- In the dialog box that opens, click the
Add externally
button.

This dialog appears if external annotations are enabled. Otherwise, annotations are added to the source code by default.