Class ThrownExceptionFinder

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.ASTVisitor
org.aspectj.org.eclipse.jdt.internal.codeassist.ThrownExceptionFinder

public class ThrownExceptionFinder extends ASTVisitor
  • Constructor Details

    • ThrownExceptionFinder

      public ThrownExceptionFinder()
  • Method Details

    • processThrownExceptions

      public void processThrownExceptions(TryStatement tryStatement, BlockScope scope)
      Finds the thrown exceptions minus the ones that are already caught in previous catch blocks. Exception is already caught even if its super type is being caught. Also computes, separately, a list comprising of (a)those exceptions that have been caught already and (b)those exceptions that are thrown by the method and whose super type has been caught already.
      Parameters:
      tryStatement -
      scope -
    • endVisit

      public void endVisit(MessageSend messageSend, BlockScope scope)
      Overrides:
      endVisit in class ASTVisitor
    • endVisit

      public void endVisit(AllocationExpression allocationExpression, BlockScope scope)
      Overrides:
      endVisit in class ASTVisitor
    • endVisit

      public void endVisit(ThrowStatement throwStatement, BlockScope scope)
      Overrides:
      endVisit in class ASTVisitor
    • getAlreadyCaughtExceptions

      public ReferenceBinding[] getAlreadyCaughtExceptions()
      Returns all the already caught exceptions in catch blocks, found by the call to processThrownExceptions(TryStatement, BlockScope)
      Returns:
      Returns an array of those exceptions that have been caught already in previous catch or multi-catch blocks of the same try block. (Exceptions caught in inner try-catches are obtained via getDiscouragedExceptions().
    • getThrownUncaughtExceptions

      public ReferenceBinding[] getThrownUncaughtExceptions()
      Returns all the thrown exceptions minus the ones that are already caught in previous catch blocks (of the same try), found by the call to processThrownExceptions(TryStatement, BlockScope).
      Returns:
      Returns an array of thrown exceptions that are still not caught in any catch block.
    • getDiscouragedExceptions

      public ReferenceBinding[] getDiscouragedExceptions()
      Returns all exceptions that are discouraged to use because (a) they are already caught in some inner try-catch, or (b) their super exception has already been caught.
      Returns:
      all discouraged exceptions
    • visit

      public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope)
      Overrides:
      visit in class ASTVisitor
    • visit

      public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope)
      Overrides:
      visit in class ASTVisitor
    • visit

      public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope)
      Overrides:
      visit in class ASTVisitor
    • visit

      public boolean visit(TryStatement tryStatement, BlockScope scope)
      Overrides:
      visit in class ASTVisitor