Class InappropriateJavadocBlockTagsOnPackageCheck
java.lang.Object
com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
com.puppycrawl.tools.checkstyle.api.AbstractCheck
com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck
com.puppycrawl.tools.checkstyle.checks.javadoc.InappropriateJavadocBlockTagsOnPackageCheck
- All Implemented Interfaces:
Configurable,Contextualizable
Checks that Javadoc block tags for package definitions do not contain tags
that are semantically invalid for packages.
Package definitions do not have return types or throw declarations. Therefore,
@return and @throws/@exception Javadoc block tags used
in their Javadoc comments are considered inappropriate and should be removed
or replaced with proper documentation.
Parent is com.puppycrawl.tools.checkstyle.TreeWalker
Violation Message Keys:
-
javadoc.inappropriate.tag
- Since:
- 14.1.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
AbstractAutomaticBean.OutputStreamOptions -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DetailASTJava AST node whose attached Javadoc is currently being processed.static final StringA key is pointing to the warning message text in "messages.properties" file.static final StringThe package keyword for logging.Fields inherited from class com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck
MSG_JAVADOC_PARSE_RULE_ERROR, MSG_KEY_UNCLOSED_HTML_TAG -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newInappropriateJavadocBlockTagsOnPackageCheckinstance. -
Method Summary
Modifier and TypeMethodDescriptionint[]The configurable token set.int[]Returns the default javadoc token types a check is interested in.int[]Returns the default token a check is interested in.int[]The javadoc tokens that this check must be registered for.int[]The tokens that this check must be registered for.private static StringgetTagName(DetailNode ast) Returns the tag name corresponding to the given Javadoc token type.voidCalled to process a Javadoc token.voidvisitToken(DetailAST ast) Called to process a token.Methods inherited from class com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck
acceptJavadocWithNonTightHtml, beginJavadocTree, beginTree, destroy, finishJavadocTree, getAcceptableJavadocTokens, getBlockCommentAst, init, isCommentNodesRequired, leaveJavadocToken, log, setJavadocTokens, setViolateExecutionOnNonTightHtmlMethods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
clearViolations, finishTree, getFileContents, getFilePath, getLine, getLineCodePoints, getLines, getTabWidth, getTokenNames, getViolations, leaveToken, log, log, log, setFileContents, setTabWidth, setTokensMethods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityMethods inherited from class com.puppycrawl.tools.checkstyle.AbstractAutomaticBean
configure, contextualize, getConfiguration, setupChild
-
Field Details
-
MSG_INAPPROPRIATE_TAG
A key is pointing to the warning message text in "messages.properties" file.- See Also:
-
PACKAGE
The package keyword for logging.- See Also:
-
currentAst
Java AST node whose attached Javadoc is currently being processed.
-
-
Constructor Details
-
InappropriateJavadocBlockTagsOnPackageCheck
Creates a newInappropriateJavadocBlockTagsOnPackageCheckinstance.
-
-
Method Details
-
getDefaultTokens
Description copied from class:AbstractCheckReturns the default token a check is interested in. Only used if the configuration for a check does not define the tokens.- Overrides:
getDefaultTokensin classAbstractJavadocCheck- Returns:
- the default tokens
- See Also:
-
getRequiredTokens
Description copied from class:AbstractCheckThe tokens that this check must be registered for.- Overrides:
getRequiredTokensin classAbstractJavadocCheck- Returns:
- the token set this must be registered for.
- See Also:
-
getAcceptableTokens
Description copied from class:AbstractCheckThe configurable token set. Used to protect Checks against malicious users who specify an unacceptable token set in the configuration file. The default implementation returns the check's default tokens.- Overrides:
getAcceptableTokensin classAbstractJavadocCheck- Returns:
- the token set this check is designed for.
- See Also:
-
visitToken
Description copied from class:AbstractCheckCalled to process a token.- Overrides:
visitTokenin classAbstractJavadocCheck- Parameters:
ast- the token to process
-
getDefaultJavadocTokens
Description copied from class:AbstractJavadocCheckReturns the default javadoc token types a check is interested in.- Specified by:
getDefaultJavadocTokensin classAbstractJavadocCheck- Returns:
- the default javadoc token types
- See Also:
-
getRequiredJavadocTokens
Description copied from class:AbstractJavadocCheckThe javadoc tokens that this check must be registered for.- Overrides:
getRequiredJavadocTokensin classAbstractJavadocCheck- Returns:
- the javadoc token set this must be registered for.
- See Also:
-
visitJavadocToken
Description copied from class:AbstractJavadocCheckCalled to process a Javadoc token.- Specified by:
visitJavadocTokenin classAbstractJavadocCheck- Parameters:
ast- the token to process
-
getTagName
Returns the tag name corresponding to the given Javadoc token type.- Parameters:
ast- the Javadoc token- Returns:
- the tag name as a string
- Throws:
IllegalArgumentException- if the token type is not recognized as a Javadoc block tag that is inappropriate for package definitions.
-