@Deprecated public abstract class AbstractTypeAwareCheck extends Check
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractTypeAwareCheck.ClassInfo
Deprecated.
Contains class's
Token . |
protected static class |
AbstractTypeAwareCheck.Token
Deprecated.
Represents text element with location in the text.
|
Constructor and Description |
---|
AbstractTypeAwareCheck()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
beginTree(DetailAST rootAST)
Deprecated.
Called before the starting to process a tree.
|
protected AbstractTypeAwareCheck.ClassInfo |
createClassInfo(AbstractTypeAwareCheck.Token name,
String surroundingClass)
Deprecated.
Creates class info for given name.
|
protected AbstractTypeAwareCheck.ClassInfo |
findClassAlias(String name)
Deprecated.
Looking if a given name is alias.
|
protected String |
getCurrentClassName()
Deprecated.
Returns current class.
|
int[] |
getRequiredTokens()
Deprecated.
The tokens that this check must be registered for.
|
protected boolean |
isSubclass(Class<?> child,
Class<?> parent)
Deprecated.
Checks if one class is subclass of another
|
protected boolean |
isUnchecked(Class<?> exception)
Deprecated.
Is exception is unchecked (subclass of
RuntimeException
or Error |
protected void |
leaveAST(DetailAST ast)
Deprecated.
Called when exiting an AST.
|
void |
leaveToken(DetailAST ast)
Deprecated.
Called after all the child nodes have been process.
|
protected abstract void |
logLoadError(AbstractTypeAwareCheck.Token ident)
Deprecated.
Logs error if unable to load class information.
|
protected void |
logLoadErrorImpl(int lineNo,
int columnNo,
String msgKey,
Object... values)
Deprecated.
Common implementation for logLoadError() method.
|
protected abstract void |
processAST(DetailAST ast)
Deprecated.
Called to process an AST when visiting it.
|
protected Class<?> |
resolveClass(String className,
String currentClass)
Deprecated.
Attempts to resolve the Class for a specified name.
|
void |
setLogLoadErrors(boolean logLoadErrors)
Deprecated.
Controls whether to log class loading errors to the checkstyle report
instead of throwing a RTE.
|
void |
setSuppressLoadErrors(boolean suppressLoadErrors)
Deprecated.
Controls whether to show class loading errors in the checkstyle report.
|
protected Class<?> |
tryLoadClass(AbstractTypeAwareCheck.Token ident,
String currentClass)
Deprecated.
Tries to load class.
|
void |
visitToken(DetailAST ast)
Deprecated.
Called to process a token.
|
destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLine, getLines, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public AbstractTypeAwareCheck()
public final void setLogLoadErrors(boolean logLoadErrors)
logLoadErrors
- true if errors should be loggedpublic final void setSuppressLoadErrors(boolean suppressLoadErrors)
suppressLoadErrors
- true if errors shouldn't be shownprotected abstract void processAST(DetailAST ast)
ast
- the AST to process. Guaranteed to not be PACKAGE_DEF or
IMPORT tokens.public final int[] getRequiredTokens()
Check
getRequiredTokens
in class Check
TokenTypes
public void beginTree(DetailAST rootAST)
Check
public final void visitToken(DetailAST ast)
Check
visitToken
in class Check
ast
- the token to processpublic final void leaveToken(DetailAST ast)
Check
leaveToken
in class Check
ast
- the token leavingprotected void leaveAST(DetailAST ast)
ast
- the AST we are departing. Guaranteed to not be PACKAGE_DEF,
CLASS_DEF, or IMPORTprotected boolean isUnchecked(Class<?> exception)
RuntimeException
or Error
exception
- Class
of exception to checkprotected boolean isSubclass(Class<?> child, Class<?> parent)
child
- Class
of class
which should be childparent
- Class
of class
which should be parentprotected final Class<?> resolveClass(String className, String currentClass)
className
- name of the class to resolvecurrentClass
- name of surrounding class.null
if unable to resolve the class.protected final Class<?> tryLoadClass(AbstractTypeAwareCheck.Token ident, String currentClass)
ident
- name of class which we try to load.currentClass
- name of surrounding class.Class
for a ident.protected abstract void logLoadError(AbstractTypeAwareCheck.Token ident)
ident
- class name for which we can no load class.protected final void logLoadErrorImpl(int lineNo, int columnNo, String msgKey, Object... values)
lineNo
- line number of the problem.columnNo
- column number of the problem.msgKey
- message key to use.values
- values to fill the message out.protected final String getCurrentClassName()
protected final AbstractTypeAwareCheck.ClassInfo createClassInfo(AbstractTypeAwareCheck.Token name, String surroundingClass)
name
- name of type.surroundingClass
- name of surrounding class.protected final AbstractTypeAwareCheck.ClassInfo findClassAlias(String name)
name
- given nameCopyright © 2001–2015. All rights reserved.