IntelliJ IDEA 2018.3 Help

Code documentation

Add Javadoc comments

For documentation comments, IntelliJ IDEA provides completion that is enabled by default. Once you type /** before a declaration and press Enter, the IDE auto-completes the doc comment for you. For method comments, the new comment stub contains the required tags (@param tags for each method parameter, @return, or @throws).

If you want to disable completion, in the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | General | Smart Keys, and clear the Insert documentation comment stub checkbox.

Add comments using the Fix doc comment action

  1. Type fix doc comment and press Enter.

IntelliJ IDEA adds the missing documentation stub with the corresponding tags.

If a method signature has been changed, IntelliJ IDEA highlights the tag that doesn't match the method signature, and suggests a quick-fix.

For tags in doc comments, IntelliJ IDEA also provides code completion. Press Ctrl+Space after the @ tag, and select the necessary tag from the suggestion list. If a certain tag has several values, you can select the necessary value from the suggestion list.

Generate a Javadoc reference

IntelliJ IDEA provides a utility that enables you to generate a Javadoc reference for your project.

  1. From the main menu, select Tools | Generate JavaDoc.

  2. In the dialog that opens, select a scope — a set of files or directories for which you want to generate the reference, and set the output directory where the generated documentation will be placed.

  3. Use the slider to define the visibility level of members that will be included in the generated documentation. Select one of the following options:

    • Private — to include all classes and members to the reference.

    • Package — to include all classes and members except the private ones.

    • Protected — to include public and protected classes and members.

    • Public — to include only public classes and members.

  4. You can specify a locale (for example en_US.UTF-8), command line arguments, and the maximum heap size.

    Javadoc reference generation dialog
  5. Click OK to generate the reference.

Last modified: 1 February 2019

See Also