Class UnusedCatchParameterShouldBeUnnamedCheck.CatchParameterDetails

java.lang.Object
com.puppycrawl.tools.checkstyle.checks.coding.UnusedCatchParameterShouldBeUnnamedCheck.CatchParameterDetails
Enclosing class:
UnusedCatchParameterShouldBeUnnamedCheck

private static final class UnusedCatchParameterShouldBeUnnamedCheck.CatchParameterDetails extends Object
Maintains information about the catch parameter.
Since:
10.18.0
  • Field Details

    • name

      private final String name
      The name of the catch parameter.
    • parameterDefinition

      private final DetailAST parameterDefinition
      Ast of type TokenTypes.PARAMETER_DEF to use it when logging.
    • used

      private boolean used
      Is the variable used.
  • Constructor Details

    • CatchParameterDetails

      private CatchParameterDetails(DetailAST enclosingCatchClause)
      Create a new catch parameter instance.
      Parameters:
      enclosingCatchClause - ast of type TokenTypes.LITERAL_CATCH
  • Method Details

    • registerAsUsed

      private void registerAsUsed()
      Register the catch parameter as used.
    • getName

      private String getName()
      Get the name of the catch parameter.
      Returns:
      the name of the catch parameter
    • isUsed

      private boolean isUsed()
      Check if the catch parameter is used.
      Returns:
      true if the catch parameter is used
    • getParameterDefinition

      private DetailAST getParameterDefinition()
      Get the parameter definition token of the catch parameter represented by ast of type TokenTypes.PARAMETER_DEF.
      Returns:
      the ast of type TokenTypes.PARAMETER_DEF