Class AbstractJavadocCheck

All Implemented Interfaces:
Configurable, Contextualizable
Direct Known Subclasses:
AtclauseOrderCheck, ClassAndPropertiesSettersJavadocScraper, JavadocBlockTagLocationCheck, JavadocLeadingAsteriskAlignCheck, JavadocMetadataScraper, JavadocMissingLeadingAsteriskCheck, JavadocMissingWhitespaceAfterAsteriskCheck, JavadocParagraphCheck, JavadocTagContinuationIndentationCheck, MissingDeprecatedCheck, NonEmptyAtclauseDescriptionCheck, RequireEmptyLineBeforeBlockTagGroupCheck, SingleLineJavadocCheck, SummaryJavadocCheck

public abstract class AbstractJavadocCheck extends AbstractCheck
Base class for Checks that process Javadoc comments.
  • Field Details

  • Constructor Details

  • Method Details

    • getDefaultJavadocTokens

      public abstract int[] getDefaultJavadocTokens()
      Returns the default javadoc token types a check is interested in.
      Returns:
      the default javadoc token types
      See Also:
    • visitJavadocToken

      public abstract void visitJavadocToken(DetailNode ast)
      Called to process a Javadoc token.
      Parameters:
      ast - the token to process
    • getAcceptableJavadocTokens

      The configurable javadoc token set. Used to protect Checks against malicious users who specify an unacceptable javadoc token set in the configuration file. The default implementation returns the check's default javadoc tokens.
      Returns:
      the javadoc token set this check is designed for.
      See Also:
    • getRequiredJavadocTokens

      public int[] getRequiredJavadocTokens()
      The javadoc tokens that this check must be registered for.
      Returns:
      the javadoc token set this must be registered for.
      See Also:
    • acceptJavadocWithNonTightHtml

      This method determines if a check should process javadoc containing non-tight html tags. This method must be overridden in checks extending AbstractJavadocCheck which are not supposed to process javadoc containing non-tight html tags.
      Returns:
      true if the check should or can process javadoc containing non-tight html tags; false otherwise
      See Also:
    • setViolateExecutionOnNonTightHtml

      public final void setViolateExecutionOnNonTightHtml(boolean shouldReportViolation)
      Setter to control when to print violations if the Javadoc being examined by this check violates the tight html rules defined at Tight-HTML Rules.
      Parameters:
      shouldReportViolation - value to which the field shall be set to
      Since:
      8.3
    • setJavadocTokens

      public final void setJavadocTokens(String... strRep)
      Adds a set of tokens the check is interested in.
      Parameters:
      strRep - the string representation of the tokens interested in
    • init

      public void init()
      Description copied from class: AbstractCheck
      Initialize the check. This is the time to verify that the check has everything required to perform its job.
      Overrides:
      init in class AbstractCheck
    • validateDefaultJavadocTokens

      Validates that check's required javadoc tokens are subset of default javadoc tokens.
      Throws:
      IllegalStateException - when validation of default javadoc tokens fails
    • beginJavadocTree

      public void beginJavadocTree(DetailNode rootAst)
      Called before the starting to process a tree.
      Parameters:
      rootAst - the root of the tree
    • finishJavadocTree

      public void finishJavadocTree(DetailNode rootAst)
      Called after finished processing a tree.
      Parameters:
      rootAst - the root of the tree
    • leaveJavadocToken

      public void leaveJavadocToken(DetailNode ast)
      Called after all the child nodes have been process.
      Parameters:
      ast - the token leaving
    • getDefaultTokens

      public final int[] getDefaultTokens()
      Defined final to not allow JavadocChecks to change default tokens.
      Specified by:
      getDefaultTokens in class AbstractCheck
      Returns:
      default tokens
      See Also:
    • getAcceptableTokens

      public final int[] getAcceptableTokens()
      Description copied from class: AbstractCheck
      The configurable token set. Used to protect Checks against malicious users who specify an unacceptable token set in the configuration file. The default implementation returns the check's default tokens.
      Specified by:
      getAcceptableTokens in class AbstractCheck
      Returns:
      the token set this check is designed for.
      See Also:
    • getRequiredTokens

      public final int[] getRequiredTokens()
      Description copied from class: AbstractCheck
      The tokens that this check must be registered for.
      Specified by:
      getRequiredTokens in class AbstractCheck
      Returns:
      the token set this must be registered for.
      See Also:
    • isCommentNodesRequired

      public final boolean isCommentNodesRequired()
      Defined final because all JavadocChecks require comment nodes.
      Overrides:
      isCommentNodesRequired in class AbstractCheck
      Returns:
      true
    • beginTree

      public final void beginTree(DetailAST rootAST)
      Description copied from class: AbstractCheck
      Called before the starting to process a tree. Ideal place to initialize information that is to be collected whilst processing a tree.
      Overrides:
      beginTree in class AbstractCheck
      Parameters:
      rootAST - the root of the tree
    • finishTree

      public final void finishTree(DetailAST rootAST)
      Description copied from class: AbstractCheck
      Called after finished processing a tree. Ideal place to report on information collected whilst processing a tree.
      Overrides:
      finishTree in class AbstractCheck
      Parameters:
      rootAST - the root of the tree
    • visitToken

      public final void visitToken(DetailAST blockCommentNode)
      Description copied from class: AbstractCheck
      Called to process a token.
      Overrides:
      visitToken in class AbstractCheck
      Parameters:
      blockCommentNode - the token to process
    • getBlockCommentAst

      Getter for block comment in Java language syntax tree.
      Returns:
      A block comment in the syntax tree.
    • processTree

      private void processTree(DetailNode root)
      Processes JavadocAST tree notifying Check.
      Parameters:
      root - root of JavadocAST tree.
    • walk

      private void walk(DetailNode root)
      Processes a node calling Check at interested nodes.
      Parameters:
      root - the root of tree for process
    • shouldBeProcessed

      private boolean shouldBeProcessed(DetailNode curNode)
      Checks whether the current node should be processed by the check.
      Parameters:
      curNode - current node.
      Returns:
      true if the current node should be processed by the check.
    • destroy

      public void destroy()
      Description copied from class: AbstractCheck
      Destroy the check. It is being retired from service.
      Overrides:
      destroy in class AbstractCheck