Class JavadocMethodCheck
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.AutomaticBean
-
- com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
-
- com.puppycrawl.tools.checkstyle.api.AbstractCheck
-
- com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck
-
- All Implemented Interfaces:
Configurable
,Contextualizable
public class JavadocMethodCheck extends AbstractCheck
Checks the Javadoc of a method or constructor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
AutomaticBean.OutputStreamOptions
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MSG_CLASS_INFO
A key is pointing to the warning message text in "messages.properties" file.static java.lang.String
MSG_DUPLICATE_TAG
A key is pointing to the warning message text in "messages.properties" file.static java.lang.String
MSG_EXPECTED_TAG
A key is pointing to the warning message text in "messages.properties" file.static java.lang.String
MSG_INVALID_INHERIT_DOC
A key is pointing to the warning message text in "messages.properties" file.static java.lang.String
MSG_RETURN_EXPECTED
A key is pointing to the warning message text in "messages.properties" file.static java.lang.String
MSG_UNUSED_TAG
A key is pointing to the warning message text in "messages.properties" file.static java.lang.String
MSG_UNUSED_TAG_GENERAL
A key is pointing to the warning message text in "messages.properties" file.
-
Constructor Summary
Constructors Constructor Description JavadocMethodCheck()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
beginTree(DetailAST rootAST)
Called before the starting to process a tree.int[]
getAcceptableTokens()
The configurable token set.int[]
getDefaultTokens()
Returns the default token a check is interested in.int[]
getRequiredTokens()
The tokens that this check must be registered for.void
leaveToken(DetailAST ast)
Called after all the child nodes have been process.void
setAllowedAnnotations(java.lang.String... userAnnotations)
Sets list of annotations.void
setAllowMissingParamTags(boolean flag)
Controls whether to allow a method which has parameters to omit matching param tags in the javadoc.void
setAllowMissingReturnTag(boolean flag)
Controls whether to allow a method which returns non-void type to omit the return tag in the javadoc.void
setAllowMissingThrowsTags(boolean flag)
Controls whether to allow a method which declares that it throws exceptions to omit matching throws tags in the javadoc.void
setAllowThrowsTagsForSubclasses(boolean flag)
Controls whether to allow documented exception that are subclass of one of declared exceptions.void
setAllowUndeclaredRTE(boolean flag)
Controls whether to allow documented exceptions that are not declared if they are a subclass of java.lang.RuntimeException.void
setExcludeScope(Scope excludeScope)
Set the excludeScope.void
setLogLoadErrors(boolean logLoadErrors)
Deprecated.No substitute.void
setScope(Scope scope)
Set the scope.void
setSuppressLoadErrors(boolean suppressLoadErrors)
Deprecated.No substitute.void
setValidateThrows(boolean value)
Allow validating throws tag.void
visitToken(DetailAST ast)
Called to process a token.-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
clearMessages, destroy, finishTree, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, log, setFileContents, setTabWidth, setTokens
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverity
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration, setupChild
-
-
-
-
Field Detail
-
MSG_CLASS_INFO
public static final java.lang.String MSG_CLASS_INFO
A key is pointing to the warning message text in "messages.properties" file.- See Also:
- Constant Field Values
-
MSG_UNUSED_TAG_GENERAL
public static final java.lang.String MSG_UNUSED_TAG_GENERAL
A key is pointing to the warning message text in "messages.properties" file.- See Also:
- Constant Field Values
-
MSG_INVALID_INHERIT_DOC
public static final java.lang.String MSG_INVALID_INHERIT_DOC
A key is pointing to the warning message text in "messages.properties" file.- See Also:
- Constant Field Values
-
MSG_UNUSED_TAG
public static final java.lang.String MSG_UNUSED_TAG
A key is pointing to the warning message text in "messages.properties" file.- See Also:
- Constant Field Values
-
MSG_EXPECTED_TAG
public static final java.lang.String MSG_EXPECTED_TAG
A key is pointing to the warning message text in "messages.properties" file.- See Also:
- Constant Field Values
-
MSG_RETURN_EXPECTED
public static final java.lang.String MSG_RETURN_EXPECTED
A key is pointing to the warning message text in "messages.properties" file.- See Also:
- Constant Field Values
-
MSG_DUPLICATE_TAG
public static final java.lang.String MSG_DUPLICATE_TAG
A key is pointing to the warning message text in "messages.properties" file.- See Also:
- Constant Field Values
-
-
Method Detail
-
setValidateThrows
public void setValidateThrows(boolean value)
Allow validating throws tag.- Parameters:
value
- user's value.
-
setAllowedAnnotations
public void setAllowedAnnotations(java.lang.String... userAnnotations)
Sets list of annotations.- Parameters:
userAnnotations
- user's value.
-
setScope
public void setScope(Scope scope)
Set the scope.- Parameters:
scope
- a scope.
-
setExcludeScope
public void setExcludeScope(Scope excludeScope)
Set the excludeScope.- Parameters:
excludeScope
- a scope.
-
setAllowUndeclaredRTE
public void setAllowUndeclaredRTE(boolean flag)
Controls whether to allow documented exceptions that are not declared if they are a subclass of java.lang.RuntimeException.- Parameters:
flag
- aBoolean
value
-
setAllowThrowsTagsForSubclasses
public void setAllowThrowsTagsForSubclasses(boolean flag)
Controls whether to allow documented exception that are subclass of one of declared exceptions.- Parameters:
flag
- aBoolean
value
-
setAllowMissingParamTags
public void setAllowMissingParamTags(boolean flag)
Controls whether to allow a method which has parameters to omit matching param tags in the javadoc. Defaults to false.- Parameters:
flag
- aBoolean
value
-
setAllowMissingThrowsTags
public void setAllowMissingThrowsTags(boolean flag)
Controls whether to allow a method which declares that it throws exceptions to omit matching throws tags in the javadoc. Defaults to false.- Parameters:
flag
- aBoolean
value
-
setAllowMissingReturnTag
public void setAllowMissingReturnTag(boolean flag)
Controls whether to allow a method which returns non-void type to omit the return tag in the javadoc. Defaults to false.- Parameters:
flag
- aBoolean
value
-
setLogLoadErrors
@Deprecated public final void setLogLoadErrors(boolean logLoadErrors)
Deprecated.No substitute.Controls whether to log class loading errors to the checkstyle report instead of throwing a RTE.- Parameters:
logLoadErrors
- true if errors should be logged
-
setSuppressLoadErrors
@Deprecated public final void setSuppressLoadErrors(boolean suppressLoadErrors)
Deprecated.No substitute.Controls whether to show class loading errors in the checkstyle report.- Parameters:
suppressLoadErrors
- true if errors shouldn't be shown
-
getRequiredTokens
public final int[] getRequiredTokens()
Description copied from class:AbstractCheck
The tokens that this check must be registered for.- Specified by:
getRequiredTokens
in classAbstractCheck
- Returns:
- the token set this must be registered for.
- See Also:
TokenTypes
-
getDefaultTokens
public int[] getDefaultTokens()
Description copied from class:AbstractCheck
Returns the default token a check is interested in. Only used if the configuration for a check does not define the tokens.- Specified by:
getDefaultTokens
in classAbstractCheck
- Returns:
- the default tokens
- See Also:
TokenTypes
-
getAcceptableTokens
public int[] getAcceptableTokens()
Description copied from class:AbstractCheck
The 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.- Specified by:
getAcceptableTokens
in classAbstractCheck
- Returns:
- the token set this check is designed for.
- See Also:
TokenTypes
-
beginTree
public void beginTree(DetailAST rootAST)
Description copied from class:AbstractCheck
Called before the starting to process a tree. Ideal place to initialize information that is to be collected whilst processing a tree.- Overrides:
beginTree
in classAbstractCheck
- Parameters:
rootAST
- the root of the tree
-
visitToken
public final void visitToken(DetailAST ast)
Description copied from class:AbstractCheck
Called to process a token.- Overrides:
visitToken
in classAbstractCheck
- Parameters:
ast
- the token to process
-
leaveToken
public final void leaveToken(DetailAST ast)
Description copied from class:AbstractCheck
Called after all the child nodes have been process.- Overrides:
leaveToken
in classAbstractCheck
- Parameters:
ast
- the token leaving
-
-