public class SuppressWarningsHolder extends Check
SuppressWarnings
annotations.Modifier and Type | Field and Description |
---|---|
static String |
CHECKSTYLE_PREFIX
Optional prefix for warning suppressions that are only intended to be
recognized by checkstyle.
|
Constructor and Description |
---|
SuppressWarningsHolder() |
Modifier and Type | Method and Description |
---|---|
void |
beginTree(DetailAST rootAST)
Called before the starting to process a tree.
|
static String |
getAlias(String sourceName)
Returns the alias for the source name of a check.
|
static String |
getDefaultAlias(String sourceName)
Returns the default alias for the source name of a check, which is the
source name in lower case with any dotted prefix or "Check" suffix
removed.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
static boolean |
isSuppressed(String sourceName,
int line,
int column)
Checks for a suppression of a check with the given source name and
location in the last file processed.
|
static void |
registerAlias(String sourceName,
String checkAlias)
Registers an alias for the source name of a check.
|
void |
setAliasList(String aliasList)
Registers a list of source name aliases based on a comma-separated list
of
source=alias items, such as com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck=
paramnum . |
void |
visitToken(DetailAST ast)
Called to process a token.
|
destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLine, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public static final String CHECKSTYLE_PREFIX
FallThroughCheck
only in checkstyle (and not in javac), use the
suppression "checkstyle:fallthrough"
. To suppress the warning in
both tools, just use "fallthrough"
.public SuppressWarningsHolder()
public static String getDefaultAlias(String sourceName)
sourceName
- the source name of the check (generally the class
name)public static String getAlias(String sourceName)
registerAlias(String, String)
, that
alias is returned; otherwise, the default alias is used.sourceName
- the source name of the check (generally the class
name)public static void registerAlias(String sourceName, String checkAlias)
sourceName
- the source name of the check (generally the class
name)checkAlias
- the alias used in SuppressWarnings
annotationspublic void setAliasList(String aliasList)
source=alias
items, such as com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck=
paramnum
.aliasList
- the list of comma-separated alias assigmentspublic static boolean isSuppressed(String sourceName, int line, int column)
sourceName
- the source name of the checkline
- the line number of the checkcolumn
- the column number of the checkpublic int[] getDefaultTokens()
Check
getDefaultTokens
in class Check
TokenTypes
public void beginTree(DetailAST rootAST)
Check
public void visitToken(DetailAST ast)
Check
visitToken
in class Check
ast
- the token to processCopyright © 2001–2015. All rights reserved.