public class NonEmptyAtclauseDescriptionCheck extends AbstractJavadocCheck
Checks that the block tag is followed by description.
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.
javadocTokens - javadoc tokens to check
Type is java.lang.String[].
Validation type is tokenSet.
Default value is
PARAM_LITERAL,
RETURN_LITERAL,
THROWS_LITERAL,
EXCEPTION_LITERAL,
DEPRECATED_LITERAL.
To configure the default check that will check @param, @return,
@throws, @deprecated:
<module name="NonEmptyAtclauseDescription"/>
Example:
class Test
{
/**
* Violation for param "b" and at tags "deprecated", "throws".
* @param a Some javadoc // OK
* @param b
* @deprecated
* @throws Exception
*/
public int method(String a, int b) throws Exception
{
return 1;
}
}
To configure the check to validate only @param and @return tags:
<module name="NonEmptyAtclauseDescription"> <property name="javadocTokens" value="PARAM_LITERAL,RETURN_LITERAL"/> </module>
Example:
class Test
{
/**
* Violation for param "b". Tags "deprecated", "throws" are ignored.
* @param a Some javadoc // OK
* @param b
* @deprecated
* @throws Exception
*/
public int method(String a, int b) throws Exception
{
return 1;
}
}
Parent is com.puppycrawl.tools.checkstyle.TreeWalker
Violation Message Keys:
javadoc.missed.html.close
javadoc.parse.rule.error
javadoc.wrong.singleton.html.tag
non.empty.atclause
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 |
|---|
NonEmptyAtclauseDescriptionCheck() |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getDefaultJavadocTokens()
Returns the default javadoc token types a check is interested in.
|
private static boolean |
hasOnlyEmptyText(DetailNode description)
Tests if description node is empty (has only new lines and blank strings).
|
private static boolean |
isEmptyTag(DetailNode tagNode)
Tests if block tag is empty.
|
void |
visitJavadocToken(DetailNode ast)
Called to process a Javadoc token.
|
acceptJavadocWithNonTightHtml, beginJavadocTree, beginTree, destroy, finishJavadocTree, finishTree, getAcceptableJavadocTokens, getAcceptableTokens, getBlockCommentAst, getDefaultTokens, getRequiredJavadocTokens, 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 NonEmptyAtclauseDescriptionCheck()
public int[] getDefaultJavadocTokens()
AbstractJavadocCheckgetDefaultJavadocTokens in class AbstractJavadocCheckJavadocTokenTypespublic void visitJavadocToken(DetailNode ast)
AbstractJavadocCheckvisitJavadocToken in class AbstractJavadocCheckast - the token to processprivate static boolean isEmptyTag(DetailNode tagNode)
tagNode - block tag.private static boolean hasOnlyEmptyText(DetailNode description)
description - description node.Copyright © 2001-2022. All Rights Reserved.