Package serp.bytecode
Class Exceptions
- java.lang.Object
-
- serp.bytecode.Attributes
-
- serp.bytecode.Attribute
-
- serp.bytecode.Exceptions
-
- All Implemented Interfaces:
BCEntity,VisitAcceptor
public class Exceptions extends Attribute
Attribute declaring the checked exceptions a method can throw.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List_indexes
-
Constructor Summary
Constructors Constructor Description Exceptions(int nameIndex, Attributes owner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptVisit(BCVisitor visit)Accept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.voidaddException(java.lang.Class type)Add an exception to those thrown by this method.voidaddException(java.lang.String type)Add an exception type to those thrown by this method.voidaddException(BCClass type)Add an exception to those thrown by this method.voidclear()Clear this method of all exception declarations.BCClass[]getExceptionBCs()Return bytecode for the exception types of this method, or an empty array if none.int[]getExceptionIndexes()Return the indexes in the classConstantPoolof theClassEntrys for the exception types thrown by this method, or an empty array if none.java.lang.String[]getExceptionNames()Return the names of the exception types for this method, or an empty array if none.java.lang.Class[]getExceptionTypes()Return theClassobjects for the exception types for this method, or an empty array if none.(package private) intgetLength()Return the length of the bytecode representation of this attribute in bytes, excluding the name index.BCMethodgetMethod()Return the owning method.(package private) voidread(java.io.DataInput in, int length)Read the attribute bytecode from the given stream, up to length bytes, excluding the name index.(package private) voidread(Attribute other)Copy the information from the given attribute to this one.booleanremoveException(java.lang.Class type)Remove an exception thrown by this method.booleanremoveException(java.lang.String type)Remove an exception type thrown by this method.booleanremoveException(BCClass type)Remove an exception thrown by this method.voidsetExceptionIndexes(int[] exceptionIndexes)Set the indexes in the classConstantPoolof theClassEntrys for the exception types thrown by this method.voidsetExceptions(java.lang.Class[] exceptions)Set the checked exceptions thrown by this method.voidsetExceptions(java.lang.String[] exceptions)Set the checked exceptions thrown by this method.voidsetExceptions(BCClass[] exceptions)Set the checked exceptions thrown by this method.booleanthrowsException(java.lang.Class type)Return true if the method declares that it throws the given exception type.booleanthrowsException(java.lang.String type)Return true if the method declares that it throws the given exception type.booleanthrowsException(BCClass type)Return true if the method declares that it throws the given exception type.(package private) voidwrite(java.io.DataOutput out, int length)Write the attribute bytecode to the given stream, up to length bytes, excluding the name index.-
Methods inherited from class serp.bytecode.Attribute
create, getAttributesHolder, getClassLoader, getName, getNameIndex, getOwner, getPool, getProject, invalidate, isValid
-
Methods inherited from class serp.bytecode.Attributes
addAttribute, addAttribute, clearAttributes, getAttribute, getAttributes, getAttributes, readAttributes, removeAttribute, removeAttribute, setAttributes, visitAttributes, writeAttributes
-
-
-
-
Constructor Detail
-
Exceptions
Exceptions(int nameIndex, Attributes owner)
-
-
Method Detail
-
getLength
int getLength()
Description copied from class:AttributeReturn the length of the bytecode representation of this attribute in bytes, excluding the name index.
-
getMethod
public BCMethod getMethod()
Return the owning method.
-
getExceptionIndexes
public int[] getExceptionIndexes()
Return the indexes in the classConstantPoolof theClassEntrys for the exception types thrown by this method, or an empty array if none.
-
setExceptionIndexes
public void setExceptionIndexes(int[] exceptionIndexes)
Set the indexes in the classConstantPoolof theClassEntrys for the exception types thrown by this method. Use null or an empty array for none.
-
getExceptionNames
public java.lang.String[] getExceptionNames()
Return the names of the exception types for this method, or an empty array if none. The names will be in a form suitable for aClass.forName(java.lang.String)call.
-
getExceptionTypes
public java.lang.Class[] getExceptionTypes()
Return theClassobjects for the exception types for this method, or an empty array if none.
-
getExceptionBCs
public BCClass[] getExceptionBCs()
Return bytecode for the exception types of this method, or an empty array if none.
-
setExceptions
public void setExceptions(java.lang.String[] exceptions)
Set the checked exceptions thrown by this method. Use null or an empty array for none.
-
setExceptions
public void setExceptions(java.lang.Class[] exceptions)
Set the checked exceptions thrown by this method. Use null or an empty array for none.
-
setExceptions
public void setExceptions(BCClass[] exceptions)
Set the checked exceptions thrown by this method. Use null or an empty array for none.
-
clear
public void clear()
Clear this method of all exception declarations.
-
removeException
public boolean removeException(java.lang.String type)
Remove an exception type thrown by this method.- Returns:
- true if the method had the exception type, false otherwise
-
removeException
public boolean removeException(java.lang.Class type)
Remove an exception thrown by this method.- Returns:
- true if the method had the exception type, false otherwise
-
removeException
public boolean removeException(BCClass type)
Remove an exception thrown by this method.- Returns:
- true if the method had the exception type, false otherwise
-
addException
public void addException(java.lang.String type)
Add an exception type to those thrown by this method.
-
addException
public void addException(java.lang.Class type)
Add an exception to those thrown by this method.
-
addException
public void addException(BCClass type)
Add an exception to those thrown by this method.
-
throwsException
public boolean throwsException(java.lang.String type)
Return true if the method declares that it throws the given exception type.
-
throwsException
public boolean throwsException(java.lang.Class type)
Return true if the method declares that it throws the given exception type.
-
throwsException
public boolean throwsException(BCClass type)
Return true if the method declares that it throws the given exception type.
-
acceptVisit
public void acceptVisit(BCVisitor visit)
Description copied from interface:VisitAcceptorAccept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.
-
read
void read(Attribute other)
Description copied from class:AttributeCopy the information from the given attribute to this one. Does nothing by default.
-
read
void read(java.io.DataInput in, int length) throws java.io.IOExceptionDescription copied from class:AttributeRead the attribute bytecode from the given stream, up to length bytes, excluding the name index. Does nothing by default.
-
write
void write(java.io.DataOutput out, int length) throws java.io.IOExceptionDescription copied from class:AttributeWrite the attribute bytecode to the given stream, up to length bytes, excluding the name index. Does nothing by default.
-
-