Class NonEmptyAtclauseDescriptionCheck

All Implemented Interfaces:
Configurable, Contextualizable

public class NonEmptyAtclauseDescriptionCheck extends AbstractJavadocCheck

Checks that the block tag is followed by description.

To configure the default check that will check @param, @return, @throws, @deprecated:

 <module name="NonEmptyAtclauseDescription"/>
 

Example:

 class Test
 {
 /**
 * Violation for param "b" and at tags "deprecated", "throws".
 * @param a Some javadoc // OK
 * @param b
 * @deprecated
 * @throws Exception
 */
 public int method(String a, int b) throws Exception
 {
 return 1;
 }
 }
 

To configure the check to validate only @param and @return tags:

 <module name="NonEmptyAtclauseDescription">
   <property name="javadocTokens" value="PARAM_LITERAL,RETURN_LITERAL"/>
 </module>
 

Example:

 class Test
 {
 /**
 * Violation for param "b". Tags "deprecated", "throws" are ignored.
 * @param a Some javadoc // OK
 * @param b
 * @deprecated
 * @throws Exception
 */
 public int method(String a, int b) throws Exception
 {
 return 1;
 }
 }
 

Parent is com.puppycrawl.tools.checkstyle.TreeWalker

Violation Message Keys:

  • javadoc.missed.html.close
  • javadoc.parse.rule.error
  • javadoc.wrong.singleton.html.tag
  • non.empty.atclause
Since:
6.0
  • Field Details

    • MSG_KEY

      public static final String MSG_KEY
      A key is pointing to the warning message text in "messages.properties" file.
      See Also:
  • Constructor Details

    • NonEmptyAtclauseDescriptionCheck

      public NonEmptyAtclauseDescriptionCheck()
  • Method Details

    • getDefaultJavadocTokens

      public int[] getDefaultJavadocTokens()
      Description copied from class: AbstractJavadocCheck
      Returns the default javadoc token types a check is interested in.
      Specified by:
      getDefaultJavadocTokens in class AbstractJavadocCheck
      Returns:
      the default javadoc token types
      See Also:
    • visitJavadocToken

      public void visitJavadocToken(DetailNode ast)
      Description copied from class: AbstractJavadocCheck
      Called to process a Javadoc token.
      Specified by:
      visitJavadocToken in class AbstractJavadocCheck
      Parameters:
      ast - the token to process
    • isEmptyTag

      private static boolean isEmptyTag(DetailNode tagNode)
      Tests if block tag is empty.
      Parameters:
      tagNode - block tag.
      Returns:
      true, if block tag is empty.
    • hasOnlyEmptyText

      private static boolean hasOnlyEmptyText(DetailNode description)
      Tests if description node is empty (has only new lines and blank strings).
      Parameters:
      description - description node.
      Returns:
      true, if description node has only new lines and blank strings.