Checks the Javadoc of a method or constructor.
By default, does not check for unused throws.
To allow documented
java.lang.RuntimeException
s
that are not declared, set property allowUndeclaredRTE to true.
The scope to verify is specified using the
Scope
class and
defaults to
Scope.PRIVATE
. To verify another scope,
set property scope to one of the
Scope
constants.
Error messages about parameters for which no param tags are
present can be suppressed by defining property
allowMissingParamTags
.
Error messages about exceptions which are declared to be thrown,
but for which no throws tag is present can be suppressed by
defining property
allowMissingThrowsTags
.
Error messages about methods which return non-void but for
which no return tag is present can be suppressed by defining
property
allowMissingReturnTag
.
An example of how to configure the check is:
<module name="JavadocMethod"/>
An example of how to configure the check to check to allow
documentation of undeclared RuntimeExceptions
and for the
Scope.PUBLIC
scope, while ignoring any missing
param tags is:
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowUndeclaredRTE" value="true"/>
<property name="allowMissingParamTags" value="true"/>
</module>
getAcceptableTokens
public int[] getAcceptableTokens()
- getAcceptableTokens in interface Check
Check
getDefaultTokens
public int[] getDefaultTokens()
- getDefaultTokens in interface Check
Check
getRequiredTokens
public int[] getRequiredTokens()
- getRequiredTokens in interface Check
Check
logLoadError
protected final void logLoadError(FullIdent aIdent)
Logs error if unable to load class information.
- logLoadError in interface AbstractTypeAwareCheck
aIdent
- class name for which we can no load class.
processAST
protected final void processAST(DetailAST aAST)
Checks Javadoc comments for a method or constructor.
- processAST in interface AbstractTypeAwareCheck
aAST
- the tree node for the method or constructor.
setAllowMissingParamTags
public void setAllowMissingParamTags(boolean aFlag)
controls whether to allow a method which has parameters
to omit matching param tags in the javadoc.
Defaults to false.
aFlag
- a Boolean
value
setAllowMissingReturnTag
public void setAllowMissingReturnTag(boolean aFlag)
controls whether to allow a method which returns
non-void type to omit the return tag in the javadoc.
Defaults to false.
aFlag
- a Boolean
value
setAllowMissingThrowsTags
public void setAllowMissingThrowsTags(boolean aFlag)
controls whether to allow a method which declares that
it throws exceptions to omit matching throws tags
in the javadoc. Defaults to false.
aFlag
- a Boolean
value
setAllowThrowsTagsForSubclasses
public void setAllowThrowsTagsForSubclasses(boolean aFlag)
controls whether to allow documented exception that
are subclass of one of declared exceptions.
aFlag
- a Boolean
value
setAllowUndeclaredRTE
public void setAllowUndeclaredRTE(boolean aFlag)
controls whether to allow documented exceptions that
are not declared if they are a subclass of
java.lang.RuntimeException.
aFlag
- a Boolean
value
setExcludeScope
public void setExcludeScope(String aScope)
Set the excludeScope.
aScope
- a String
value
setScope
public void setScope(String aFrom)
Set the scope.
aFrom
- a String
value