public abstract class AbstractJavadocCheck extends AbstractCheck
| Modifier and Type | Class and Description |
|---|---|
private static class |
AbstractJavadocCheck.FileContext
The file context holder.
|
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
private java.lang.ThreadLocal<AbstractJavadocCheck.FileContext> |
context
The file context.
|
private java.util.Set<java.lang.Integer> |
javadocTokens
The javadoc tokens the check is interested in.
|
static java.lang.String |
MSG_JAVADOC_MISSED_HTML_CLOSE
Message key of error message.
|
static java.lang.String |
MSG_JAVADOC_PARSE_RULE_ERROR
Parse error while rule recognition.
|
static java.lang.String |
MSG_JAVADOC_WRONG_SINGLETON_TAG
Message key of error message.
|
private static java.lang.ThreadLocal<java.util.Map<LineColumn,JavadocDetailNodeParser.ParseStatus>> |
TREE_CACHE
Key is "line:column".
|
private boolean |
violateExecutionOnNonTightHtml
This property determines if a check should log a violation upon encountering javadoc with
non-tight html.
|
| Constructor and Description |
|---|
AbstractJavadocCheck() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptJavadocWithNonTightHtml()
This method determines if a check should process javadoc containing non-tight html tags.
|
void |
beginJavadocTree(DetailNode rootAst)
Called before the starting to process a tree.
|
void |
beginTree(DetailAST rootAST)
Called before the starting to process a tree.
|
void |
destroy()
Destroy the check.
|
void |
finishJavadocTree(DetailNode rootAst)
Called after finished processing a tree.
|
void |
finishTree(DetailAST rootAST)
Called after finished processing a tree.
|
int[] |
getAcceptableJavadocTokens()
The configurable javadoc token set.
|
int[] |
getAcceptableTokens()
The configurable token set.
|
protected DetailAST |
getBlockCommentAst()
Getter for block comment in Java language syntax tree.
|
abstract int[] |
getDefaultJavadocTokens()
Returns the default javadoc token types a check is interested in.
|
int[] |
getDefaultTokens()
Defined final to not allow JavadocChecks to change default tokens.
|
int[] |
getRequiredJavadocTokens()
The javadoc tokens that this check must be registered for.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
void |
init()
Initialize the check.
|
boolean |
isCommentNodesRequired()
Defined final because all JavadocChecks require comment nodes.
|
void |
leaveJavadocToken(DetailNode ast)
Called after all the child nodes have been process.
|
private void |
processTree(DetailNode root)
Processes JavadocAST tree notifying Check.
|
void |
setJavadocTokens(java.lang.String... strRep)
Adds a set of tokens the check is interested in.
|
void |
setViolateExecutionOnNonTightHtml(boolean shouldReportViolation)
Setter to control when to print violations if the Javadoc being examined by this check
violates the tight html rules defined at
Tight-HTML Rules.
|
private boolean |
shouldBeProcessed(DetailNode curNode)
Checks whether the current node should be processed by the check.
|
private void |
validateDefaultJavadocTokens()
Validates that check's required javadoc tokens are subset of default javadoc tokens.
|
abstract void |
visitJavadocToken(DetailNode ast)
Called to process a Javadoc token.
|
void |
visitToken(DetailAST blockCommentNode)
Called to process a token.
|
private void |
walk(DetailNode root)
Processes a node calling Check at interested nodes.
|
clearViolations, 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_JAVADOC_MISSED_HTML_CLOSE
"no viable alternative at input 'b \n *\n'" and it is not
clear that error is about missed close HTML tag.public static final java.lang.String MSG_JAVADOC_WRONG_SINGLETON_TAG
public static final java.lang.String MSG_JAVADOC_PARSE_RULE_ERROR
private static final java.lang.ThreadLocal<java.util.Map<LineColumn,JavadocDetailNodeParser.ParseStatus>> TREE_CACHE
DetailNode tree. Map is stored in ThreadLocal
to guarantee basic thread safety and avoid shared, mutable state when not necessary.private final java.lang.ThreadLocal<AbstractJavadocCheck.FileContext> context
private final java.util.Set<java.lang.Integer> javadocTokens
private boolean violateExecutionOnNonTightHtml
public AbstractJavadocCheck()
public abstract int[] getDefaultJavadocTokens()
JavadocTokenTypespublic abstract void visitJavadocToken(DetailNode ast)
ast - the token to processpublic int[] getAcceptableJavadocTokens()
JavadocTokenTypespublic int[] getRequiredJavadocTokens()
JavadocTokenTypespublic boolean acceptJavadocWithNonTightHtml()
AbstractJavadocCheck which
are not supposed to process javadoc containing non-tight html tags.JavadocDetailNodeParser.ParseStatus.isNonTight(),
Tight HTML rulespublic final void setViolateExecutionOnNonTightHtml(boolean shouldReportViolation)
shouldReportViolation - value to which the field shall be set topublic final void setJavadocTokens(java.lang.String... strRep)
strRep - the string representation of the tokens interested inpublic void init()
AbstractCheckinit in class AbstractCheckprivate void validateDefaultJavadocTokens()
java.lang.IllegalStateException - when validation of default javadoc tokens failspublic void beginJavadocTree(DetailNode rootAst)
rootAst - the root of the treepublic void finishJavadocTree(DetailNode rootAst)
rootAst - the root of the treepublic void leaveJavadocToken(DetailNode ast)
ast - the token leavingpublic final int[] getDefaultTokens()
getDefaultTokens in class AbstractCheckTokenTypespublic final int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic final int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypespublic final boolean isCommentNodesRequired()
isCommentNodesRequired in class AbstractCheckpublic final void beginTree(DetailAST rootAST)
AbstractCheckbeginTree in class AbstractCheckrootAST - the root of the treepublic final void finishTree(DetailAST rootAST)
AbstractCheckfinishTree in class AbstractCheckrootAST - the root of the treepublic final void visitToken(DetailAST blockCommentNode)
AbstractCheckvisitToken in class AbstractCheckblockCommentNode - the token to processprotected DetailAST getBlockCommentAst()
private void processTree(DetailNode root)
root - root of JavadocAST tree.private void walk(DetailNode root)
root - the root of tree for processprivate boolean shouldBeProcessed(DetailNode curNode)
curNode - current node.public void destroy()
AbstractCheckdestroy in class AbstractCheckCopyright © 2001-2022. All Rights Reserved.