|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.puppycrawl.tools.checkstyle.api.AutomaticBean com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter com.puppycrawl.tools.checkstyle.api.Check com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck
Abstract class that endeavours to maintain type information for the Java file being checked. It provides helper methods for performing type information functions.
Nested Class Summary | |
protected class |
AbstractTypeAwareCheck.ClassInfo
Contains class's FullIdent
and Class object if we can load it. |
Constructor Summary | |
protected |
AbstractTypeAwareCheck(boolean aProcessClassToken)
Create an object. |
Method Summary | |
void |
beginTree(DetailAST aRootAST)
Called before the starting to process a tree. |
protected java.lang.String |
getCurrentClassName()
Returns current class. |
protected boolean |
isSameType(java.lang.String aFirst,
java.lang.String aSecond)
Return if two Strings represent the same type, inspecting the import statements if necessary |
protected boolean |
isShortName(java.lang.String aShortName,
java.lang.String aFullName)
Calculate if one type name is a shortname for another type name. |
protected boolean |
isSubclass(java.lang.Class aChild,
java.lang.Class aParent)
Checks if one class is subclass of another |
protected boolean |
isUnchecked(java.lang.Class aException)
Is exception is unchecked (subclass of RuntimeException
or Error |
void |
leaveToken(DetailAST aAST)
Called after all the child nodes have been process. |
protected abstract void |
logLoadError(FullIdent aIdent)
Logs error if unable to load class information. |
protected abstract void |
processAST(DetailAST aAST)
Called to process an AST when visiting it. |
protected java.lang.Class |
resolveClass(java.lang.String aClassName,
java.lang.String aCurrentClass)
Attempts to resolve the Class for a specified name. |
protected java.lang.Class |
tryLoadClass(FullIdent aIdent,
java.lang.String aCurrentClass)
Tries to load class. |
void |
visitToken(DetailAST aAST)
Called to process a token. |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check |
destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter |
getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setSeverity |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean |
configure, contextualize, finishLocalSetup, getConfiguration, setupChild |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected AbstractTypeAwareCheck(boolean aProcessClassToken)
CLASS_DEF
token in your list you need to pass true
to this
constructor. Otherwise, you need to add the
CLASS_DEF
token to your list and pass
false
to this constructor.
aProcessClassToken
- indicated if subclass wants to be notified
of CLASS tokens.Method Detail |
protected abstract void processAST(DetailAST aAST)
aAST
- the AST to process. Guaranteed to not be PACKAGE_DEF or
IMPORT tokens.public void beginTree(DetailAST aRootAST)
Check
beginTree
in class Check
aRootAST
- the root of the treeCheck
public final void visitToken(DetailAST aAST)
Check
visitToken
in class Check
aAST
- the token to processCheck
public final void leaveToken(DetailAST aAST)
Check
leaveToken
in class Check
aAST
- the token leavingCheck
protected boolean isShortName(java.lang.String aShortName, java.lang.String aFullName)
aShortName
- a shorthand, such as IOException
aFullName
- a full name, such as java.io.IOException
protected boolean isUnchecked(java.lang.Class aException)
RuntimeException
or Error
aException
- Class
of exception to check
protected boolean isSubclass(java.lang.Class aChild, java.lang.Class aParent)
aChild
- Class
of class
which should be childaParent
- Class
of class
which should be parent
protected boolean isSameType(java.lang.String aFirst, java.lang.String aSecond)
aFirst
- first type declared in throws clauseaSecond
- second type declared in thros tag
protected final java.lang.Class resolveClass(java.lang.String aClassName, java.lang.String aCurrentClass)
aClassName
- name of the class to resolveaCurrentClass
- name of surrounding class.
null
if unable to resolve the class.protected final java.lang.Class tryLoadClass(FullIdent aIdent, java.lang.String aCurrentClass)
aIdent
- name of class which we try to load.aCurrentClass
- name of surrounding class.
Class
for a ident.protected abstract void logLoadError(FullIdent aIdent)
aIdent
- class name for which we can no load class.protected final java.lang.String getCurrentClassName()
|
Back to the Checkstyle Home Page | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |