JavadocMissingLeadingAsterisk

Since Checkstyle 8.38

Description

Checks if the javadoc has leading asterisks on each line.

The check does not require asterisks on the first line, nor on the last line if it is blank. All other lines in a Javadoc should start with *, including blank lines and code blocks.

Properties

name description type default value since
violateExecutionOnNonTightHtml Control when to print violations if the Javadoc being examined by this check violates the tight html rules defined at Tight-HTML Rules. boolean false 8.38

Examples

To configure the check:

<module name="Checker">
  <module name="TreeWalker">
    <module name="JavadocMissingLeadingAsterisk"/>
  </module>
</module>
        

Example:

/**
 * Valid Java-style comment.
 *
 * <pre>
 *   int value = 0;
 * </pre>
 */
class JavaStyle {}

/** Valid Scala-style comment.
  * Some description here.
  **/
class ScalaStyle {}

/** **
  * Asterisks on first and last lines are optional.
  * */
class Asterisks {}

/** No asterisks are required for single-line comments. */
class SingleLine {}

/**

 */ // violation above, 'Javadoc line should start with leading asterisk'
class BlankLine {}

/** Wrapped
    single-line comment */
// violation above, 'Javadoc line should start with leading asterisk'
class Wrapped {}

/**
  * <pre>
    int value; // violation, 'Javadoc line should start with leading asterisk'
  * </pre>
  */
class Example1 {}
        

Example of Usage

Violation Messages

All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.

Package

com.puppycrawl.tools.checkstyle.checks.javadoc

Parent Module

TreeWalker