Working with 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,
If you want to disable completion, in the Settings/Preferences dialog (Ctrl+Alt+S), go to , and clear the Insert documentation comment stub checkbox.
Add comments using the Fix doc comment action
fix doc commentand 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.
From the main menu, select.
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.
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.
You can specify a locale (for example
en_US.UTF-8), command line arguments, and the maximum heap size.
Click OK to generate the reference.