APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.generic

public final Class CodeExceptionGen

extends Object
implements InstructionTargeter, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, com.sun.org.apache.bcel.internal.generic.InstructionTargeter
Imports
com.sun.org.apache.bcel.internal.classfile.CodeException

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.
See Also
MethodGen, CodeException, InstructionHandle

Field Summary

Modifier and TypeField and Description
private ObjectType
pack-priv static final CodeExceptionGen[]
private InstructionHandle
private InstructionHandle
private InstructionHandle

Constructor Summary

AccessConstructor and Description
public
CodeExceptionGen(final InstructionHandle
Start of handled region (inclusive)
startPc
,
final InstructionHandle
End of handled region (inclusive)
endPc
,
final InstructionHandle
Where handling is done
handlerPc
,
final ObjectType
which exception is handled, null for ANY
catchType
)

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

Returns:

true, if ih is target of this handler
containsTarget
(final InstructionHandle ih)

Implements com.sun.org.apache.bcel.internal.generic.InstructionTargeter.containsTarget.

Tests whether this targeter targets the specified instruction handle.

public ObjectType
getCatchType()

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

public CodeException
getCodeException(final ConstantPoolGen
constant pool
cp
)

Gets CodeException object.

public InstructionHandle
getEndPC()

Returns: end of handled region (inclusive)

public InstructionHandle
getHandlerPC()

Returns: start of handler

public InstructionHandle
getStartPC()

Returns: start of handled region (inclusive)

public void
setCatchType(final ObjectType catchType)

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
updateTarget(final InstructionHandle
old target, either start or end
oldIh
,
final InstructionHandle
new target
newIh
)

Implements com.sun.org.apache.bcel.internal.generic.InstructionTargeter.updateTarget.

Replaces the target of this targeter from this old handle to the new handle.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

catchTypeback to summary
private ObjectType catchType
EMPTY_ARRAYback to summary
pack-priv static final CodeExceptionGen[] EMPTY_ARRAY
endPcback to summary
private InstructionHandle endPc
handlerPcback to summary
private InstructionHandle handlerPc
startPcback to summary
private InstructionHandle startPc

Constructor Detail

CodeExceptionGenback to summary
public CodeExceptionGen(final InstructionHandle startPc, final InstructionHandle endPc, final InstructionHandle handlerPc, final ObjectType catchType)

Add an exception handler, i.e., specify region where a handler is active and an instruction where the actual handling is done.

Parameters
startPc:InstructionHandle

Start of handled region (inclusive)

endPc:InstructionHandle

End of handled region (inclusive)

handlerPc:InstructionHandle

Where handling is done

catchType: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.

Annotations
@Override
containsTargetback to summary
public boolean containsTarget(final InstructionHandle ih)

Implements com.sun.org.apache.bcel.internal.generic.InstructionTargeter.containsTarget.

Doc from com.sun.org.apache.bcel.internal.generic.InstructionTargeter.containsTarget.

Tests whether this targeter targets the specified instruction handle.

Returns:boolean

true, if ih is target of this handler

Annotations
@Override
getCatchTypeback to summary
public ObjectType getCatchType()

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

getCodeExceptionback to summary
public CodeException getCodeException(final ConstantPoolGen cp)

Gets CodeException object.
This relies on that the instruction list has already been dumped to byte code or that the 'setPositions' methods has been called for the instruction list.

Parameters
cp:ConstantPoolGen

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(final ObjectType catchType)

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

setEndPCback to summary
public void setEndPC(final InstructionHandle endPc)
setHandlerPCback to summary
public void setHandlerPC(final InstructionHandle handlerPc)
setStartPCback to summary
public void setStartPC(final InstructionHandle startPc)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
updateTargetback to summary
public void updateTarget(final InstructionHandle oldIh, final InstructionHandle newIh)

Implements com.sun.org.apache.bcel.internal.generic.InstructionTargeter.updateTarget.

Doc from com.sun.org.apache.bcel.internal.generic.InstructionTargeter.updateTarget.

Replaces the target of this targeter from this old handle to the new handle.

Parameters
oldIh:InstructionHandle

old target, either start or end

newIh:InstructionHandle

new target

Annotations
@Override