|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rit.classfile.SubroutineReference
edu.rit.classfile.SubroutineDescription
edu.rit.classfile.SynthesizedSubroutineDescription
edu.rit.classfile.SynthesizedConstructorDescription
public class SynthesizedConstructorDescription
Class SynthesizedConstructorDescription is used to synthesize a subroutine description for some actual constructor. To synthesize a constructor:
Or:
In the documentation below, the term "described constructor" means "the synthesized constructor described by this synthesized constructor description object."
Constructor Summary | |
---|---|
SynthesizedConstructorDescription(SynthesizedClassDescription theClassDescription)
Construct a new synthesized constructor description object. |
|
SynthesizedConstructorDescription(SynthesizedClassDescription theClassDescription,
String theMethodDescriptor)
Construct a new synthesized constructor description object with the given method descriptor. |
Method Summary | |
---|---|
void |
addArgumentType(TypeReference theArgumentType)
Add an argument to this described constructor. |
void |
addExceptionHandler(Location theStartLocation,
Location theEndLocation,
Location theHandlerLocation,
ClassReference theCatchType)
Add an exception handler to the described constructor's list of exception handlers. |
void |
addInstruction(Instruction theInstruction)
Adds the given instruction to the described constructor's list of bytecode instructions. |
void |
addThrownException(ClassReference theExceptionClass)
Add a thrown exception to this described constructor. |
void |
increaseMaxLocals(int theMaxLocals)
Increase the described constructor's max_locals item if necessary. |
void |
increaseMaxStack(int theMaxStack)
Increase the described constructor's max_stack item if necessary. |
void |
setMaxLocals(int theMaxLocals)
Specify the described constructor's max_locals item. |
void |
setMaxStack(int theMaxStack)
Specify the described constructor's max_stack item. |
void |
setMethodDescriptor(String theMethodDescriptor)
Specify the described constructor's method descriptor. |
void |
setPackageScoped()
Specify that the described constructor has default access (also known as package scoped), that is, may be accessed only from inside its defining package or inside its defining class. |
void |
setPrivate()
Specify that the described constructor is private, that is, may be accessed only from inside its defining class. |
void |
setProtected()
Specify that the described constructor is protected, that is, may be accessed only from inside its defining package, inside its defining class, or inside subclasses of its defining class. |
void |
setPublic()
Specify that the described constructor is public, that is, may be accessed from inside and outside its defining package. |
void |
setStrictfp(boolean isStrictfp)
Specify whether the described constructor uses strict floating point mode. |
Methods inherited from class edu.rit.classfile.SubroutineDescription |
---|
getCodeLength, getExceptionHandlers, getInstructions, getMaxLocals, getMaxStack, getThrownExceptions, isAbstract, isFinal, isNative, isPackageScoped, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized |
Methods inherited from class edu.rit.classfile.SubroutineReference |
---|
equals, getArgumentTypes, getArgumentWordCount, getClassReference, getMethodDescriptor, getMethodName, getReturnType, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SynthesizedConstructorDescription(SynthesizedClassDescription theClassDescription) throws ListFullException
theClassDescription
- Class containing this constructor.
NullPointerException
- (unchecked exception) Thrown if theClassDescription is null.
ListFullException
- Thrown if theClassDescription's subroutine list is full
(i.e., contains 65535 subroutines).public SynthesizedConstructorDescription(SynthesizedClassDescription theClassDescription, String theMethodDescriptor) throws ListFullException
theClassDescription
- Class containing this constructor.theMethodDescriptor
- Method descriptor in the format specified by Section 4.3.3 of the
Java Virtual Machine Specification, Second Edition.
NullPointerException
- (unchecked exception) Thrown if theClassDescription is null
or theMethodDescriptor is null.
IllegalArgumentException
- (unchecked exception) Thrown if theMethodDescriptor does not
obey the syntax of a method descriptor. Thrown if
theMethodDescriptor indicates that the return type is not
void. Thrown if the number of arguments in
theMethodDescriptor exceeds the limit (254).
ListFullException
- Thrown if theClassDescription's subroutine list is full
(i.e., contains 65535 subroutines).Method Detail |
---|
public void setPublic()
public void setPrivate()
public void setProtected()
public void setPackageScoped()
public void setStrictfp(boolean isStrictfp)
isStrictfp
- True to use strict floating point mode, false not to
use strict floating point mode.public void addArgumentType(TypeReference theArgumentType) throws ListFullException
theArgumentType
- Argument's type reference.
NullPointerException
- (unchecked exception) Thrown if theArgumentType is null.
ListFullException
- Thrown if adding theArgumentType would cause the described
constructor's argument word count to exceed the limit (254).public void setMethodDescriptor(String theMethodDescriptor)
theMethodDescriptor
- Method descriptor in the format specified by Section 4.3.3 of the
Java Virtual Machine Specification, Second Edition.
NullPointerException
- (unchecked exception) Thrown if theMethodDescriptor is null.
IllegalStateException
- (unchecked exception) Thrown if the method descriptor cannot be
set because this constructor description is already in use.
IllegalArgumentException
- (unchecked exception) Thrown if theMethodDescriptor does not
obey the syntax of a method descriptor. Thrown if
theMethodDescriptor indicates that the return type is not
void. Thrown if the number of arguments in
theMethodDescriptor exceeds the limit (254).public void addThrownException(ClassReference theExceptionClass) throws ListFullException
theExceptionClass
- Exception's class reference.
NullPointerException
- (unchecked exception) Thrown if theExceptionClass is null.
ListFullException
- Thrown if the requisite constant pool entries could not be added
because the constant pool is full. Also thrown if the described
constructor's thrown exception list is full (i.e., contains 65535
thrown exceptions).public void addInstruction(Instruction theInstruction) throws ListFullException
theInstruction
- Instruction to add.
NullPointerException
- (unchecked exception) Thrown if theInstruction is null.
ListFullException
- Thrown if the requisite constant pool entries could not be added
because the described constructor's class's constant pool is full.
Also thrown if adding theInstruction would cause the
described constructor's code length to exceed the maximum allowed
value (65534 bytes).public void addExceptionHandler(Location theStartLocation, Location theEndLocation, Location theHandlerLocation, ClassReference theCatchType) throws ListFullException
theStartLocation
- Start location. This is the location of the first instruction in the
constructor's bytecode sequence covered by the exception
handler. (The start location is inclusive.)theEndLocation
- End location. This is the location of the next instruction after the
last instruction in the constructor's bytecode sequence covered
by the exception handler. (The end location is exclusive.)theHandlerLocation
- Handler location. This is the location of the first instruction in
the exception handler itself.theCatchType
- Catch type. This is a class reference to the exception class caught
by the exception handler. Null means the exception handler catches
all exceptions.
NullPointerException
- (unchecked exception) Thrown if theStartLocation is null,
theEndLocation is null, or theHandlerLocation is
null.
IllegalArgumentException
- (unchecked exception) Thrown if any of the following is true:
ListFullException
- Thrown if the requisite constant pool entries could not be added
because the described constructor's class's constant pool was
full. Also thrown if the described constructor's exception
handler list is full (i.e., contains 65535 exception handlers).public void setMaxStack(int theMaxStack) throws OutOfRangeException
theMaxStack
- max_stack value.
OutOfRangeException
- Thrown if theMaxStack is not in the range 0 .. 65535.public void increaseMaxStack(int theMaxStack) throws OutOfRangeException
theMaxStack
- max_stack value.
OutOfRangeException
- Thrown if theMaxStack is not in the range 0 .. 65535.public void setMaxLocals(int theMaxLocals) throws OutOfRangeException
theMaxLocals
- max_locals value.
OutOfRangeException
- Thrown if theMaxLocals is not in the range 0 .. 65535.public void increaseMaxLocals(int theMaxLocals) throws OutOfRangeException
theMaxLocals
- max_locals value.
OutOfRangeException
- Thrown if theMaxLocals is not in the range 0 .. 65535.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |