public class JavadocMissingWhitespaceAfterAsteriskCheck extends AbstractJavadocCheck
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.
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 default check:
<module name="JavadocMissingWhitespaceAfterAsterisk"/>
Code Example:
/** This is valid single-line Javadoc. */
class TestClass {
/**
*This is invalid Javadoc.
*/
int invalidJavaDoc;
/**
* This is valid Javadoc.
*/
void validJavaDocMethod() {
}
/**This is invalid single-line Javadoc. */
void invalidSingleLineJavaDocMethod() {
}
/** This is valid single-line Javadoc. */
void validSingleLineJavaDocMethod() {
}
}
Parent is com.puppycrawl.tools.checkstyle.TreeWalker
Violation Message Keys:
javadoc.missed.html.close
javadoc.missing.whitespace
javadoc.parse.rule.error
javadoc.wrong.singleton.html.tag
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MSG_KEY
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 |
|---|
JavadocMissingWhitespaceAfterAsteriskCheck() |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getDefaultJavadocTokens()
Returns the default javadoc token types a check is interested in.
|
private static int |
getLastLeadingAsteriskPosition(java.lang.String text)
Finds the position of the last leading asterisk in the string.
|
int[] |
getRequiredJavadocTokens()
The javadoc tokens that this check must be registered for.
|
private static boolean |
isLast(int position,
java.lang.String text)
Checks if the character position is the last one of the string.
|
void |
visitJavadocToken(DetailNode detailNode)
Called to process a Javadoc token.
|
acceptJavadocWithNonTightHtml, beginJavadocTree, beginTree, destroy, finishJavadocTree, finishTree, getAcceptableJavadocTokens, 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_KEY
public JavadocMissingWhitespaceAfterAsteriskCheck()
public int[] getDefaultJavadocTokens()
AbstractJavadocCheckgetDefaultJavadocTokens in class AbstractJavadocCheckJavadocTokenTypespublic int[] getRequiredJavadocTokens()
AbstractJavadocCheckgetRequiredJavadocTokens in class AbstractJavadocCheckJavadocTokenTypespublic void visitJavadocToken(DetailNode detailNode)
AbstractJavadocCheckvisitJavadocToken in class AbstractJavadocCheckdetailNode - the token to processprivate static boolean isLast(int position, java.lang.String text)
position - the position of the charactertext - String literal.private static int getLastLeadingAsteriskPosition(java.lang.String text)
text contains no leading asterisk, -1 will be returned.text - String literal.Copyright © 2001-2022. All Rights Reserved.