public class RedundantThrowsCheck extends AbstractTypeAwareCheck
An example of how to configure the check is:
<module name="RedundantThrows"> <property name="allowUnchecked" value="true"/> <property name="allowSubclasses" value="true"/> </module>
AbstractTypeAwareCheck.ClassInfo, AbstractTypeAwareCheck.Token
Constructor and Description |
---|
RedundantThrowsCheck() |
Modifier and Type | Method and Description |
---|---|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
protected void |
logLoadError(AbstractTypeAwareCheck.Token aIdent)
Logs error if unable to load class information.
|
protected void |
processAST(DetailAST aAST)
Checks exceptions declared in throws for a method or constructor.
|
void |
setAllowSubclasses(boolean aAllowSubclasses)
Getter for allowSubclasses property.
|
void |
setAllowUnchecked(boolean aAllowUnchecked)
Getter for allowUnchecked property.
|
beginTree, createClassInfo, findClassAlias, getCurrentClassName, getRequiredTokens, isSubclass, isUnchecked, leaveAST, leaveToken, logLoadErrorImpl, resolveClass, setLogLoadErrors, setSuppressLoadErrors, tryLoadClass, visitToken
destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getTabWidth, getTokenNames, init, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public void setAllowUnchecked(boolean aAllowUnchecked)
aAllowUnchecked
- whether unchecked excpetions in throws
are allowed or notpublic void setAllowSubclasses(boolean aAllowSubclasses)
aAllowSubclasses
- whether subclass of another declared
exception is allowed in throws clausepublic int[] getDefaultTokens()
getDefaultTokens
in class Check
TokenTypes
protected final void processAST(DetailAST aAST)
processAST
in class AbstractTypeAwareCheck
aAST
- the tree node for the method or constructor.protected final void logLoadError(AbstractTypeAwareCheck.Token aIdent)
logLoadError
in class AbstractTypeAwareCheck
aIdent
- class name for which we can no load class.