Package javassist.bytecode
Class ExceptionTable
- java.lang.Object
-
- javassist.bytecode.ExceptionTable
-
- All Implemented Interfaces:
java.lang.Cloneable
public class ExceptionTable extends java.lang.Object implements java.lang.Cloneableexception_table[]ofCode_attribute.
-
-
Constructor Summary
Constructors Constructor Description ExceptionTable(ConstPool cp)Constructs anexception_table[].
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int start, int end, int handler, int type)Appends a new entry at the end of the table.voidadd(int index, int start, int end, int handler, int type)Adds a new entry at the specified position in the table.voidadd(int index, ExceptionTable table, int offset)Copies the given exception table at the specified position in the table.intcatchType(int nth)ReturnscatchTypeof the n-th entry.java.lang.Objectclone()Creates and returns a copy of this object.ExceptionTablecopy(ConstPool newCp, java.util.Map<java.lang.String,java.lang.String> classnames)Makes a copy of thisexception_table[].intendPc(int nth)ReturnsendPcof the n-th entry.inthandlerPc(int nth)ReturnshandlerPcof the n-th entry.voidremove(int index)Removes the entry at the specified position in the table.voidsetCatchType(int nth, int value)SetscatchTypeof the n-th entry.voidsetEndPc(int nth, int value)SetsendPcof the n-th entry.voidsetHandlerPc(int nth, int value)SetshandlerPcof the n-th entry.voidsetStartPc(int nth, int value)SetsstartPcof the n-th entry.intsize()Returnsexception_table_length, which is the number of entries in theexception_table[].intstartPc(int nth)ReturnsstartPcof the n-th entry.
-
-
-
Constructor Detail
-
ExceptionTable
public ExceptionTable(ConstPool cp)
Constructs anexception_table[].- Parameters:
cp- constant pool table.
-
-
Method Detail
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionCreates and returns a copy of this object. The constant pool object is shared between this object and the cloned object.- Throws:
java.lang.CloneNotSupportedException
-
size
public int size()
Returnsexception_table_length, which is the number of entries in theexception_table[].
-
startPc
public int startPc(int nth)
ReturnsstartPcof the n-th entry.- Parameters:
nth- the n-th (>= 0).
-
setStartPc
public void setStartPc(int nth, int value)SetsstartPcof the n-th entry.- Parameters:
nth- the n-th (>= 0).value- new value.
-
endPc
public int endPc(int nth)
ReturnsendPcof the n-th entry.- Parameters:
nth- the n-th (>= 0).
-
setEndPc
public void setEndPc(int nth, int value)SetsendPcof the n-th entry.- Parameters:
nth- the n-th (>= 0).value- new value.
-
handlerPc
public int handlerPc(int nth)
ReturnshandlerPcof the n-th entry.- Parameters:
nth- the n-th (>= 0).
-
setHandlerPc
public void setHandlerPc(int nth, int value)SetshandlerPcof the n-th entry.- Parameters:
nth- the n-th (>= 0).value- new value.
-
catchType
public int catchType(int nth)
ReturnscatchTypeof the n-th entry.- Parameters:
nth- the n-th (>= 0).- Returns:
- an index into the
constant_pooltable, or zero if this exception handler is for all exceptions.
-
setCatchType
public void setCatchType(int nth, int value)SetscatchTypeof the n-th entry.- Parameters:
nth- the n-th (>= 0).value- new value.
-
add
public void add(int index, ExceptionTable table, int offset)Copies the given exception table at the specified position in the table.- Parameters:
index- index (>= 0) at which the entry is to be inserted.offset- the offset added to the code position.
-
add
public void add(int index, int start, int end, int handler, int type)Adds a new entry at the specified position in the table.- Parameters:
index- index (>= 0) at which the entry is to be inserted.start-startPcend-endPchandler-handlerPctype-catchType
-
add
public void add(int start, int end, int handler, int type)Appends a new entry at the end of the table.- Parameters:
start-startPcend-endPchandler-handlerPctype-catchType
-
remove
public void remove(int index)
Removes the entry at the specified position in the table.- Parameters:
index- the index of the removed entry.
-
copy
public ExceptionTable copy(ConstPool newCp, java.util.Map<java.lang.String,java.lang.String> classnames)
Makes a copy of thisexception_table[]. Class names are replaced according to the givenMapobject.- Parameters:
newCp- the constant pool table used by the new copy.classnames- pairs of replaced and substituted class names.
-
-