public class JavadocMissingLeadingAsteriskCheck extends AbstractJavadocCheck
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.
violateExecutionOnNonTightHtml - Control when to print violations if the
Javadoc being examined by this check violates the tight html rules defined at
Tight-HTML Rules.
Type is boolean.
Default value is false.
To configure the check:
<module name="JavadocMissingLeadingAsterisk"/>
Example:
/**
* Valid Java-style comment.
*
* <pre>
* int value = 0;
* </pre>
*/
class JavaStyle {} // ok
/** Valid Scala-style comment.
* Some description here.
**/
class ScalaStyle {} // ok
/** **
* Asterisks on first and last lines are optional.
* */
class Asterisks {} // ok
/** No asterisks are required for single-line comments. */
class SingleLine {} // ok
/** // violation on next blank line, javadoc has lines without leading asterisk.
*/
class BlankLine {}
/** Wrapped
single-line comment */ // violation, javadoc has lines without leading asterisk.
class Wrapped {}
/**
* <pre>
int value; // violation, javadoc has lines without leading asterisk.
* </pre>
*/
class Code {}
Parent is com.puppycrawl.tools.checkstyle.TreeWalker
Violation Message Keys:
javadoc.missed.html.close
javadoc.missing.asterisk
javadoc.parse.rule.error
javadoc.wrong.singleton.html.tag
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MSG_MISSING_ASTERISK
A key is pointing to the warning message text in "messages.properties"
file.
|
MSG_JAVADOC_MISSED_HTML_CLOSE, MSG_JAVADOC_PARSE_RULE_ERROR, MSG_JAVADOC_WRONG_SINGLETON_TAG| Constructor and Description |
|---|
JavadocMissingLeadingAsteriskCheck() |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getAcceptableJavadocTokens()
The configurable javadoc token set.
|
int[] |
getDefaultJavadocTokens()
Returns the default javadoc token types a check is interested in.
|
private static DetailNode |
getNextNode(DetailNode detailNode)
Gets next node in the ast (sibling or parent sibling for the last node).
|
int[] |
getRequiredJavadocTokens()
The javadoc tokens that this check must be registered for.
|
private static boolean |
isLastLine(DetailNode detailNode)
Checks whether this node is the end of a Javadoc comment,
optionally preceded by blank text.
|
private static boolean |
isLeadingAsterisk(DetailNode detailNode)
Checks whether the given node is a leading asterisk.
|
void |
visitJavadocToken(DetailNode detailNode)
Called to process a Javadoc token.
|
acceptJavadocWithNonTightHtml, beginJavadocTree, beginTree, destroy, finishJavadocTree, finishTree, getAcceptableTokens, getBlockCommentAst, getDefaultTokens, getRequiredTokens, init, isCommentNodesRequired, leaveJavadocToken, setJavadocTokens, setViolateExecutionOnNonTightHtml, visitTokenclearViolations, getFileContents, getLine, getLineCodePoints, getLines, getTabWidth, getTokenNames, getViolations, leaveToken, log, log, log, setFileContents, setTabWidth, setTokensfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic static final java.lang.String MSG_MISSING_ASTERISK
public JavadocMissingLeadingAsteriskCheck()
public int[] getRequiredJavadocTokens()
AbstractJavadocCheckgetRequiredJavadocTokens in class AbstractJavadocCheckJavadocTokenTypespublic int[] getAcceptableJavadocTokens()
AbstractJavadocCheckgetAcceptableJavadocTokens in class AbstractJavadocCheckJavadocTokenTypespublic int[] getDefaultJavadocTokens()
AbstractJavadocCheckgetDefaultJavadocTokens in class AbstractJavadocCheckJavadocTokenTypespublic void visitJavadocToken(DetailNode detailNode)
AbstractJavadocCheckvisitJavadocToken in class AbstractJavadocCheckdetailNode - the token to processprivate static DetailNode getNextNode(DetailNode detailNode)
detailNode - the node to processprivate static boolean isLeadingAsterisk(DetailNode detailNode)
detailNode - the node to processtrue if the node is JavadocTokenTypes.LEADING_ASTERISKprivate static boolean isLastLine(DetailNode detailNode)
detailNode - the node to processtrue if the node is JavadocTokenTypes.EOFCopyright © 2001-2022. All Rights Reserved.