Skip to content

Commit

Permalink
Issue #3672: update documentation about getAcceptableTokens for javad…
Browse files Browse the repository at this point in the history
…oc Checks
  • Loading branch information
romani committed Dec 29, 2016
1 parent 8e9c98f commit 92aea35
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/xdocs/writingjavadocchecks.xml.vm
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,18 @@ java -cp checkstyle-${projectVersion}-all.jar com.puppycrawl.tools.checkstyle.gu
</section>

<section name="Customize token types in Javadoc Checks">
<p>
Java checks controlled by method <a href="writingchecks.html#Understanding_token_sets">setTokens(), getDefaultTokens(), getAccessibleTokens(), getRequiredTokens(). </a>
JavaDoc checks use the same model plus extra 4 methods for Javadoc tokens.
As Java AST and Javadoc AST are not binded.
It is highly recommended for Javadoc checks do not use customization of java tokens and expect to be executed only on javadoc tokens.
</p>
<p>
There are four methods in AbstractJavadocCheck class to control the processed
<a href="apidocs/index.html">JavadocTokenTypes</a> -
one setter
<a href="apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#setJavadocTokens-java.lang.String...-">
setTokens()</a>, which is used to define a custom set (which is different
setJavadocTokens()</a>, which is used to define a custom set (which is different
from the default one) of the processed JavadocTokenTypes via config file and
three getters, which have to be overridden:
<a href="apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getDefaultJavadocTokens--">
Expand All @@ -515,19 +521,26 @@ java -cp checkstyle-${projectVersion}-all.jar com.puppycrawl.tools.checkstyle.gu
<ul>

<li>
getDefaultJavadocTokens() - returns a set of JavadocTokenTypes which are processed in
<a href="apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#setJavadocTokens--">
setJavadocTokens()</a> - method then define actual set of tokens to run on.
</li>
<li>
<a href="apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getDefaultJavadocTokens--">
getDefaultJavadocTokens()</a> - returns a set of JavadocTokenTypes which are processed in
<a href="apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#visitToken-com.puppycrawl.tools.checkstyle.api.DetailAST-">
visitToken()</a> method by default.
</li>

<li>
getRequiredJavadocTokens() - returns a set of JavadocTokenTypes which Check must be subscribed to for
<a href="apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getRequiredJavadocTokens--">
getRequiredJavadocTokens()</a> - returns a set of JavadocTokenTypes which Check must be subscribed to for
a valid execution. If the user wants to specify a custom set of JavadocTokenTypes then
this set must contain all the JavadocTokenTypes from RequiredJavadocTokens.
</li>

<li>
getAcceptableJavadocTokens() - returns a set, which contains all the JavadocTokenTypes that
<a href="apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getAcceptableJavadocTokens--">
getAcceptableJavadocTokens()</a> - returns a set, which contains all the JavadocTokenTypes that
can be processed by the check. Both DefaultJavadocTokens and RequiredJavadocTokens and any custom
set of JavadocTokenTypes are subsets of AcceptableJavadocTokens.
</li>
Expand Down

0 comments on commit 92aea35

Please sign in to comment.