Class InvalidJavadocPositionCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    public class InvalidJavadocPositionCheck
    extends AbstractCheck

    Checks that Javadocs are located at the correct position. As specified at Documentation Comment Specification for the Standard Doclet, Javadocs are recognized only when placed immediately before module, package, class, interface, constructor, method, or field declarations. Any other position, like in the body of a method, will be ignored by the javadoc tool and is considered invalid by this check.

    To configure the check:

     <module name="InvalidJavadocPosition"/>
     

    The following code produces a violation because Javadocs should be before all annotations of the Javadoc's target:

     @SuppressWarnings("serial")
     /**
      * This comment looks like javadoc but it at an invalid location.
      * Therefore, the text will not get into TestClass.html and the check will produce a violation.
      */
     public class TestClass {
     }
     

    Parent is com.puppycrawl.tools.checkstyle.TreeWalker

    Violation Message Keys:

    • invalid.position
    Since:
    8.23