harpoon.IR.RawClass
Class ExceptionTable

java.lang.Object
  extended by harpoon.IR.RawClass.ExceptionTable

public class ExceptionTable
extends Object

Each ExceptionTable object describes one exception handler in the code array of an AttributeCode.

Version:
$Id: ExceptionTable.java,v 1.2 2002/02/25 21:05:27 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
"The Java Virtual Machine Specification, section 4.7.4", AttributeCode

Field Summary
 int catch_type
          If the value of the catch_type item is nonzero, it must be a valid index into the constant_pool table.
 int end_pc
          The values of the two items start_pc and end_pc indicate the ranges in the code array at which the exception handler is active.
 int handler_pc
          The value of the handler_pc item indicates the start of the exception handler.
protected  ClassFile parent
          ClassFile in which this attribute information is found.
 int start_pc
          The values of the two items start_pc and end_pc indicate the ranges in the code array at which the exception handler is active.
 
Constructor Summary
ExceptionTable(ClassFile parent, int start_pc, int end_pc, int handler_pc, int catch_type)
          Constructor.
 
Method Summary
 ConstantClass catch_type()
           
 void print(PrintWriter pw, int indent)
          Pretty-print this entry.
 String toString()
          Human-readable representation.
 void write(ClassDataOutputStream out)
          Write to bytecode stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected ClassFile parent
ClassFile in which this attribute information is found.


start_pc

public int start_pc
The values of the two items start_pc and end_pc indicate the ranges in the code array at which the exception handler is active. The value of start_pc must be a valid index into the code array of the opcode of an instruction. The value of start_pc must be less than the value of end_pc.

The start_pc is inclusive.


end_pc

public int end_pc
The values of the two items start_pc and end_pc indicate the ranges in the code array at which the exception handler is active. The value of end_pc either must be a valid index into the code array of the opcode of an instruction, or must be equal to code_length, the length of the code array. The value of start_pc must be less than the value of end_pc.

The end_pc is exclusive.


handler_pc

public int handler_pc
The value of the handler_pc item indicates the start of the exception handler. The value of the item must be a valid index into the code array, must be the index of the opcode of an instruction, and must be less than the value of the code_length item.


catch_type

public int catch_type
If the value of the catch_type item is nonzero, it must be a valid index into the constant_pool table. the constant_pool entry at that index must be a CONSTANT_Class_info structure representing a class of exceptions that this exception handler is designated to catch. This class must be the class Throwable of one of its subclasses. The exception handler will be called only if the thrown exception is an instance of the given class or one of its subclasses.

If the value of the catch_type item is zero, this exception handler is called for all exceptions. This is used to implement finally.

Constructor Detail

ExceptionTable

public ExceptionTable(ClassFile parent,
                      int start_pc,
                      int end_pc,
                      int handler_pc,
                      int catch_type)
Constructor.

Method Detail

write

public void write(ClassDataOutputStream out)
           throws IOException
Write to bytecode stream.

Throws:
IOException

catch_type

public ConstantClass catch_type()

toString

public String toString()
Human-readable representation.

Overrides:
toString in class Object

print

public void print(PrintWriter pw,
                  int indent)
Pretty-print this entry.

Parameters:
indent - the indentation level to use.