Class JavadocMissingWhitespaceAfterAsteriskCheck

All Implemented Interfaces:
Configurable, Contextualizable

Checks that there is at least one whitespace after the leading asterisk. Although spaces after asterisks are optional in the Javadoc comments, their absence makes the documentation difficult to read. It is the de facto standard to put at least one whitespace after the leading asterisk.
Since:
8.32
  • Field Details

  • Constructor Details

  • 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:
    • getRequiredJavadocTokens

      public int[] getRequiredJavadocTokens()
      Description copied from class: AbstractJavadocCheck
      The javadoc tokens that this check must be registered for.
      Overrides:
      getRequiredJavadocTokens in class AbstractJavadocCheck
      Returns:
      the javadoc token set this must be registered for.
      See Also:
    • visitJavadocToken

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

      private static DetailNode resolveNextNode(DetailNode detailNode)
      Resolves the first child node related to the given Javadoc DetailNode.

      The resolution works in two steps:

      • If the current node is of type JAVADOC_CONTENT, use its first child; otherwise use its next sibling.
      • If that base node has a first child, return it regardless of its type.

      The returned node may or may not be of type TEXT. If it is not, the violation logic will treat it as a violation later.

      Parameters:
      detailNode - the Javadoc node to resolve from
      Returns:
      the first child node if available; otherwise null
    • isLast

      private static boolean isLast(int position, String text)
      Checks if the character position is the last one of the string.
      Parameters:
      position - the position of the character
      text - String literal.
      Returns:
      true if the character position is the last one of the string.
    • getLastLeadingAsteriskPosition

      private static int getLastLeadingAsteriskPosition(String text)
      Finds the position of the last leading asterisk in the string. If text contains no leading asterisk, -1 will be returned.
      Parameters:
      text - String literal.
      Returns:
      the index of the last leading asterisk.