Package serp.bytecode
Class Exceptions
java.lang.Object
serp.bytecode.Attributes
serp.bytecode.Attribute
serp.bytecode.Exceptions
- All Implemented Interfaces:
BCEntity
,VisitAcceptor
Attribute declaring the checked exceptions a method can throw.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptVisit
(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.void
addException
(Class type) Add an exception to those thrown by this method.void
addException
(String type) Add an exception type to those thrown by this method.void
addException
(BCClass type) Add an exception to those thrown by this method.void
clear()
Clear this method of all exception declarations.BCClass[]
Return bytecode for the exception types of this method, or an empty array if none.int[]
Return the indexes in the classConstantPool
of theClassEntry
s for the exception types thrown by this method, or an empty array if none.String[]
Return the names of the exception types for this method, or an empty array if none.Class[]
Return theClass
objects for the exception types for this method, or an empty array if none.(package private) int
Return the length of the bytecode representation of this attribute in bytes, excluding the name index.Return the owning method.(package private) void
Read the attribute bytecode from the given stream, up to length bytes, excluding the name index.(package private) void
Copy the information from the given attribute to this one.boolean
removeException
(Class type) Remove an exception thrown by this method.boolean
removeException
(String type) Remove an exception type thrown by this method.boolean
removeException
(BCClass type) Remove an exception thrown by this method.void
setExceptionIndexes
(int[] exceptionIndexes) Set the indexes in the classConstantPool
of theClassEntry
s for the exception types thrown by this method.void
setExceptions
(Class[] exceptions) Set the checked exceptions thrown by this method.void
setExceptions
(String[] exceptions) Set the checked exceptions thrown by this method.void
setExceptions
(BCClass[] exceptions) Set the checked exceptions thrown by this method.boolean
throwsException
(Class type) Return true if the method declares that it throws the given exception type.boolean
throwsException
(String type) Return true if the method declares that it throws the given exception type.boolean
throwsException
(BCClass type) Return true if the method declares that it throws the given exception type.(package private) void
write
(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
-
Field Details
-
_indexes
-
-
Constructor Details
-
Exceptions
Exceptions(int nameIndex, Attributes owner)
-
-
Method Details
-
getLength
int getLength()Description copied from class:Attribute
Return the length of the bytecode representation of this attribute in bytes, excluding the name index. -
getMethod
Return the owning method. -
getExceptionIndexes
public int[] getExceptionIndexes()Return the indexes in the classConstantPool
of theClassEntry
s 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 classConstantPool
of theClassEntry
s for the exception types thrown by this method. Use null or an empty array for none. -
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
Return theClass
objects for the exception types for this method, or an empty array if none. -
getExceptionBCs
Return bytecode for the exception types of this method, or an empty array if none. -
setExceptions
Set the checked exceptions thrown by this method. Use null or an empty array for none. -
setExceptions
Set the checked exceptions thrown by this method. Use null or an empty array for none. -
setExceptions
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
Remove an exception type thrown by this method.- Returns:
- true if the method had the exception type, false otherwise
-
removeException
Remove an exception thrown by this method.- Returns:
- true if the method had the exception type, false otherwise
-
removeException
Remove an exception thrown by this method.- Returns:
- true if the method had the exception type, false otherwise
-
addException
Add an exception type to those thrown by this method. -
addException
Add an exception to those thrown by this method. -
addException
Add an exception to those thrown by this method. -
throwsException
Return true if the method declares that it throws the given exception type. -
throwsException
Return true if the method declares that it throws the given exception type. -
throwsException
Return true if the method declares that it throws the given exception type. -
acceptVisit
Description copied from interface:VisitAcceptor
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. -
read
Description copied from class:Attribute
Copy the information from the given attribute to this one. Does nothing by default. -
read
Description copied from class:Attribute
Read the attribute bytecode from the given stream, up to length bytes, excluding the name index. Does nothing by default.- Overrides:
read
in classAttribute
- Throws:
IOException
-
write
Description copied from class:Attribute
Write the attribute bytecode to the given stream, up to length bytes, excluding the name index. Does nothing by default.- Overrides:
write
in classAttribute
- Throws:
IOException
-