Top Description Fields Constructors Methods
org.aspectj.apache.bcel.generic

public final Class CodeExceptionGen

extends Object
implements InstructionTargeter, Cloneable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Cloneable, org.aspectj.apache.bcel.generic.InstructionTargeter
Imports
org.aspectj.apache.bcel.classfile.CodeException, .ConstantPool

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.
Author
M. Dahm
Version
$Id: CodeExceptionGen.java,v 1.5 2008/05/28 23:52:56 aclement Exp $
See Also
MethodGen, CodeException, InstructionHandle

Field Summary

Modifier and TypeField and Description
private ObjectType
private InstructionHandle
private InstructionHandle
private InstructionHandle

Constructor Summary

AccessConstructor and Description
public
CodeExceptionGen(InstructionHandle
Start of handled region (inclusive)
start_pc
,
InstructionHandle
End of handled region (inclusive)
end_pc
,
InstructionHandle
Where handling is done
handler_pc
,
ObjectType
which exception is handled, null for ANY
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

Modifier and TypeMethod and Description
public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public boolean
public ObjectType
getCatchType()

Gets the type of the Exception to catch, 'null' for ANY.

public CodeException
getCodeException(ConstantPool
constant pool
cp
)

Get CodeException object.

public InstructionHandle

Returns:

end of handled region (inclusive)
getEndPC
()

public InstructionHandle

Returns:

start of handler
getHandlerPC
()

public InstructionHandle

Returns:

start of handled region (inclusive)
getStartPC
()

public void
setCatchType(ObjectType catch_type)

Sets the type of the Exception to catch.

public void
public void
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

catch_typeback to summary
private ObjectType catch_type
end_pcback to summary
private InstructionHandle end_pc
handler_pcback to summary
private InstructionHandle handler_pc
start_pcback to summary
private InstructionHandle start_pc

Constructor Detail

CodeExceptionGenback to summary
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.

Parameters
start_pc:InstructionHandle

Start of handled region (inclusive)

end_pc:InstructionHandle

End of handled region (inclusive)

handler_pc:InstructionHandle

Where handling is done

catch_type:ObjectType

which exception is handled, null for ANY

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

containsTargetback to summary
public boolean containsTarget(InstructionHandle ih)

Implements org.aspectj.apache.bcel.generic.InstructionTargeter.containsTarget.

Returns:boolean

true, if ih is target of this handler

getCatchTypeback to summary
public ObjectType getCatchType()

Gets the type of the Exception to catch, 'null' for ANY.

getCodeExceptionback to summary
public CodeException getCodeException(ConstantPool 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.

Parameters
cp:ConstantPool

constant pool

getEndPCback to summary
public InstructionHandle getEndPC()
Returns:InstructionHandle

end of handled region (inclusive)

getHandlerPCback to summary
public InstructionHandle getHandlerPC()
Returns:InstructionHandle

start of handler

getStartPCback to summary
public InstructionHandle getStartPC()
Returns:InstructionHandle

start of handled region (inclusive)

setCatchTypeback to summary
public void setCatchType(ObjectType catch_type)

Sets the type of the Exception to catch. Set 'null' for ANY.

setEndPCback to summary
public void setEndPC(InstructionHandle end_pc)
setHandlerPCback to summary
public void setHandlerPC(InstructionHandle handler_pc)
setStartPCback to summary
public void setStartPC(InstructionHandle start_pc)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

updateTargetback to summary
public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih)

Implements org.aspectj.apache.bcel.generic.InstructionTargeter.updateTarget.

Parameters
old_ih:InstructionHandle

old target, either start or end

new_ih:InstructionHandle

new target