Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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

Nested Class Summary

Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck
`AbstractTypeAwareCheck.ClassInfo, AbstractTypeAwareCheck.Token`

Constructor Summary
`RedundantThrowsCheck()`

Method Summary
`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.

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 com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
`getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setId, 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

### RedundantThrowsCheck

    public RedundantThrowsCheck()

Method Detail

### 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()

  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)

  Checks exceptions declared in throws for a method or constructor.

  Specified by:
    `processAST` in class `AbstractTypeAwareCheck`
  Parameters:
    `aAST` - the tree node for the method or constructor.

### logLoadError

    protected final void logLoadError(AbstractTypeAwareCheck.Token aIdent)

  Logs error if unable to load class information.

  Specified by:
    `logLoadError` in class `AbstractTypeAwareCheck`
  Parameters:
    `aIdent` - class name for which we can no load class.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Back to the Checkstyle Home Page
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD