Class Handler

java.lang.Object
javassist.expr.Expr
javassist.expr.Handler
All Implemented Interfaces:
Opcode

public class Handler extends Expr
A catch clause or a finally block.
  • Method Details

    • where

      public CtBehavior where()
      Returns the method or constructor containing the catch clause.
      Overrides:
      where in class Expr
    • getLineNumber

      public int getLineNumber()
      Returns the source line number of the catch clause.
      Overrides:
      getLineNumber in class Expr
      Returns:
      -1 if this information is not available.
    • getFileName

      public String getFileName()
      Returns the source file containing the catch clause.
      Overrides:
      getFileName in class Expr
      Returns:
      null if this information is not available.
    • mayThrow

      public CtClass[] mayThrow()
      Returns the list of exceptions that the catch clause may throw.
      Overrides:
      mayThrow in class Expr
    • getType

      public CtClass getType() throws NotFoundException
      Returns the type handled by the catch clause. If this is a finally block, null is returned.
      Throws:
      NotFoundException
    • isFinally

      public boolean isFinally()
      Returns true if this is a finally block.
    • replace

      public void replace(String statement) throws CannotCompileException
      This method has not been implemented yet.
      Specified by:
      replace in class Expr
      Parameters:
      statement - a Java statement except try-catch.
      Throws:
      CannotCompileException
    • insertBefore

      public void insertBefore(String src) throws CannotCompileException
      Inserts bytecode at the beginning of the catch clause. The caught exception is stored in $1.
      Parameters:
      src - the source code representing the inserted bytecode. It must be a single statement or block.
      Throws:
      CannotCompileException