Class Catch

java.lang.Object
EDU.purdue.cs.bloat.reflect.Catch

public class Catch extends Object
Catch stores information about a protected block and an exception handler in a method. The startPC, endPC, and handlerPC are indices into the bytecode of the method where the protected block begins and ends and the catch block begins, respectively. They are indices into the code array.
See Also:
  • Code.code
  • Constructor Summary

    Constructors
    Constructor
    Description
    Catch(int startPC, int endPC, int handlerPC, int catchType)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the index into the constant pool of the type of exception to catch.
     
    int
    Get the end PC of the protected block.
    int
    Get the start PC of the exception handler.
    void
    setCatchTypeIndex(int index)
    Set the index into the constant pool of the type of exception to catch.
    void
    setEndPC(int pc)
    Set the end PC of the protected block.
    void
    setHandlerPC(int pc)
    Set the start PC of the exception handler.
    void
    setStartPC(int pc)
    Set the start PC of the protected block.
    int
    Get the start PC of the protected block.
    Returns a string representation of the catch information.

    Methods inherited from class Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Catch

      public Catch(int startPC, int endPC, int handlerPC, int catchType)
      Constructor.
      Parameters:
      startPC - The start PC of the protected block.
      endPC - The PC of the instruction after the end of the protected block.
      handlerPC - The start PC of the exception handler.
      catchType - The type of exception to catch.
  • Method Details

    • startPC

      public int startPC()
      Get the start PC of the protected block.
      Returns:
      The start PC of the protected block.
      See Also:
    • setStartPC

      public void setStartPC(int pc)
      Set the start PC of the protected block.
      Parameters:
      pc - The start PC of the protected block.
      See Also:
      • startPC
    • endPC

      public int endPC()
      Get the end PC of the protected block.
      Returns:
      The PC of the instruction after the end of the protected block.
      See Also:
    • setEndPC

      public void setEndPC(int pc)
      Set the end PC of the protected block.
      Parameters:
      pc - The PC of the instruction after the end of the protected block.
      See Also:
      • endPC
    • handlerPC

      public int handlerPC()
      Get the start PC of the exception handler.
      Returns:
      The start PC of the exception handler.
      See Also:
    • setHandlerPC

      public void setHandlerPC(int pc)
      Set the start PC of the exception handler.
      Parameters:
      pc - The start PC of the exception handler.
      See Also:
      • handlerPC
    • catchTypeIndex

      public int catchTypeIndex()
      Get the index into the constant pool of the type of exception to catch.
      Returns:
      Index of the type of exception to catch.
      See Also:
    • setCatchTypeIndex

      public void setCatchTypeIndex(int index)
      Set the index into the constant pool of the type of exception to catch.
      Parameters:
      index - Index of the type of exception to catch.
      See Also:
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • toString

      public String toString()
      Returns a string representation of the catch information.
      Overrides:
      toString in class Object