com.puppycrawl.tools.checkstyle.checks.coding
Class RedundantThrowsCheck
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
com.puppycrawl.tools.checkstyle.checks.coding.RedundantThrowsCheck
- All Implemented Interfaces:
- Configurable, Contextualizable
public class RedundantThrowsCheck
- extends AbstractTypeAwareCheck
Checks for redundant exceptions declared in throws clause
such as duplicates, unchecked exceptions or subclasses of
another declared exception.
An example of how to configure the check is:
<module name="RedundantThrows">
<property name="allowUnchecked" value="true"/>
<property name="allowSubclasses" value="true"/>
</module>
- Author:
- o_sukhodolsky
Methods inherited from class com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck |
beginTree, createClassInfo, findClassAlias, getCurrentClassName, getRequiredTokens, isSubclass, isUnchecked, leaveAST, leaveToken, logLoadErrorImpl, resolveClass, setLogLoadErrors, setSuppressLoadErrors, tryLoadClass, visitToken |
Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check |
destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getTabWidth, getTokenNames, init, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RedundantThrowsCheck
public RedundantThrowsCheck()
setAllowUnchecked
public void setAllowUnchecked(boolean aAllowUnchecked)
- Getter for allowUnchecked property.
- Parameters:
aAllowUnchecked
- whether unchecked excpetions in throws
are allowed or not
setAllowSubclasses
public void setAllowSubclasses(boolean aAllowSubclasses)
- Getter for allowSubclasses property.
- Parameters:
aAllowSubclasses
- whether subclass of another declared
exception is allowed in throws clause
getDefaultTokens
public int[] getDefaultTokens()
- Description copied from class:
Check
- Returns the default token a check is interested in. Only used if the
configuration for a check does not define the tokens.
- Specified by:
getDefaultTokens
in class Check
- Returns:
- the default tokens
- See Also:
TokenTypes
processAST
protected final void processAST(DetailAST aAST)
- Description copied from class:
AbstractTypeAwareCheck
- Called to process an AST when visiting it.
- Specified by:
processAST
in class AbstractTypeAwareCheck
- Parameters:
aAST
- the AST to process. Guaranteed to not be PACKAGE_DEF or
IMPORT tokens.
logLoadError
protected final void logLoadError(AbstractTypeAwareCheck.Token aIdent)
- Description copied from class:
AbstractTypeAwareCheck
- Logs error if unable to load class information.
Abstract, should be overrided in subclasses.
- Specified by:
logLoadError
in class AbstractTypeAwareCheck
- Parameters:
aIdent
- class name for which we can no load class.