IntelliJ IDEA 11.1 Web Help

10.5+

In this section:

Basics

In Java files, IntelliJ IDEA creates stubs of documentation comments on typing the opening tag and pressing EnterEnter.

If this feature applies to the methods, @param tags are created for each parameter declared in the method signature, @return tag is created if the method is not void, and @throws tags are created for each exception statement.

When you create additional tags, IntelliJ IDEA provides code completion that suggests the possible tag names.

If a certain tag has multiple values, the same code completion provides the list of available values. Smart type code completion suggests the list of classes that are appropriate for the specific exception.

Note

Documentation comments in your source code are available for the Quick Documentation Lookup and open for review on pressing Ctrl+QControl J.

To enable generation of documentation comment stubs
  1. Open IDE Settings, and expand the Editor node.
  2. In the Smart Keys page, select the check box Insert documentation comment stub.
To create a documentation comment for a method or function
  1. Place the caret before the declaration.
  2. Type the opening block comment /**, and press EnterEnter.
  3. Add meaningful description of parameters and return values.

Tip

  • IntelliJ IDEA checks syntax in the documentation comments and treats it according to the Error settings.
  • If the entered text contains HTML tags, the closing tag will be automatically added after typing >, provided that this behavior is enabled in the editor settings.
  • When typing in a documentation comment, the caret automatically moves to an expected position. For example:

    javadoc_smart_enter

To create tags in a documentation comment block
  1. In a comment block, select the desired empty line and type @ character.
  2. Press Ctrl+SpaceControl Space, or just wait for Code Completion to display the suggestion list:

    doc_comment_tags

  3. Select a tag from the suggestion list. For example, you can specify the parameters type, or return type.
  4. If a certain tag has several values, press Ctrl+SpaceControl Space after the tag, and select the desired value from the suggestion list. For example, IntelliJ IDEA suggests to select the desired parameter name.

    code_completion_param

See Also

Procedures:

Reference:

Web Resources: