Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.bcel.generic
Class CodeExceptionGen  view CodeExceptionGen download CodeExceptionGen.java

java.lang.Object
  extended byorg.apache.bcel.generic.CodeExceptionGen
All Implemented Interfaces:
java.lang.Cloneable, InstructionTargeter, java.io.Serializable

public final class CodeExceptionGen
extends java.lang.Object
implements InstructionTargeter, java.lang.Cloneable, java.io.Serializable

This class represents an exception handler, i.e., specifies the region where a handler is active and an instruction where the actual handling is done. pool as parameters. Opposed to the JVM specification the end of the handled region is set to be inclusive, i.e. all instructions between start and end are protected including the start and end instructions (handles) themselves. The end of the region is automatically mapped to be exclusive when calling getCodeException(), i.e., there is no difference semantically.

Version:
$Id: CodeExceptionGen.java 386056 2006-03-15 11:31:56Z tcurdt $

Field Summary
private  ObjectType catch_type
           
private  InstructionHandle end_pc
           
private  InstructionHandle handler_pc
           
private  InstructionHandle start_pc
           
 
Constructor Summary
CodeExceptionGen(InstructionHandle start_pc, InstructionHandle end_pc, InstructionHandle handler_pc, ObjectType catch_type)
          Add an exception handler, i.e., specify region where a handler is active and an instruction where the actual handling is done.
 
Method Summary
 java.lang.Object clone()
          This method may be called to create a new copy of the Object.
 boolean containsTarget(InstructionHandle ih)
           
 ObjectType getCatchType()
          Gets the type of the Exception to catch, 'null' for ANY.
 org.apache.bcel.classfile.CodeException getCodeException(ConstantPoolGen cp)
          Get CodeException object.
This relies on that the instruction list has already been dumped to byte code or or that the `setPositions' methods has been called for the instruction list.
 InstructionHandle getEndPC()
           
 InstructionHandle getHandlerPC()
           
 InstructionHandle getStartPC()
           
 void setCatchType(ObjectType catch_type)
          Sets the type of the Exception to catch.
 void setEndPC(InstructionHandle end_pc)
           
 void setHandlerPC(InstructionHandle handler_pc)
           
 void setStartPC(InstructionHandle start_pc)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

start_pc

private InstructionHandle start_pc

end_pc

private InstructionHandle end_pc

handler_pc

private InstructionHandle handler_pc

catch_type

private ObjectType catch_type
Constructor Detail

CodeExceptionGen

public CodeExceptionGen(InstructionHandle start_pc,
                        InstructionHandle end_pc,
                        InstructionHandle handler_pc,
                        ObjectType catch_type)
Add an exception handler, i.e., specify region where a handler is active and an instruction where the actual handling is done.

Method Detail

getCodeException

public org.apache.bcel.classfile.CodeException getCodeException(ConstantPoolGen cp)
Get CodeException object.
This relies on that the instruction list has already been dumped to byte code or or that the `setPositions' methods has been called for the instruction list.


setStartPC

public void setStartPC(InstructionHandle start_pc)

setEndPC

public void setEndPC(InstructionHandle end_pc)

setHandlerPC

public void setHandlerPC(InstructionHandle handler_pc)

updateTarget

public void updateTarget(InstructionHandle old_ih,
                         InstructionHandle new_ih)
Specified by:
updateTarget in interface InstructionTargeter

containsTarget

public boolean containsTarget(InstructionHandle ih)
Specified by:
containsTarget in interface InstructionTargeter

setCatchType

public void setCatchType(ObjectType catch_type)
Sets the type of the Exception to catch. Set 'null' for ANY.


getCatchType

public ObjectType getCatchType()
Gets the type of the Exception to catch, 'null' for ANY.


getStartPC

public InstructionHandle getStartPC()

getEndPC

public InstructionHandle getEndPC()

getHandlerPC

public InstructionHandle getHandlerPC()

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


clone

public java.lang.Object clone()
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }