public abstract class SimplifiedInvocationUnit extends java.lang.Object implements InvocationUnit, ParameterVisitor, ConstantVisitor
InvocationUnit sets up the variables for entering a method,
and it updates the stack for the invocation of a class member,
using simple values.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isLoad |
protected boolean |
isStatic |
protected Method |
method |
protected Stack |
stack |
protected Variables |
variables |
| Constructor and Description |
|---|
SimplifiedInvocationUnit() |
| Modifier and Type | Method and Description |
|---|---|
void |
enterExceptionHandler(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
int catchType,
Stack stack)
Sets up the given stack for entering the given exception handler.
|
void |
enterMethod(Clazz clazz,
Method method,
Variables variables)
Sets up the given variables for entering the given method.
|
void |
exitMethod(Clazz clazz,
Method method,
Value returnValue)
Exits the given method with the given return value.
|
abstract Value |
getExceptionValue(Clazz clazz,
ClassConstant catchClassConstant)
Returns the value of the specified exception.
|
abstract Value |
getFieldClassValue(Clazz clazz,
FieldrefConstant fieldrefConstant,
java.lang.String type)
Returns the class though which the specified field is accessed.
|
abstract Value |
getFieldValue(Clazz clazz,
FieldrefConstant fieldrefConstant,
java.lang.String type)
Returns the value of the specified field.
|
abstract Value |
getMethodParameterValue(Clazz clazz,
Method method,
int parameterIndex,
java.lang.String type,
Clazz referencedClass)
Returns the value of the specified method parameter.
|
abstract Value |
getMethodReturnValue(Clazz clazz,
AnyMethodrefConstant anyMethodrefConstant,
java.lang.String type)
Returns the return value of the specified method.
|
abstract Value |
getMethodReturnValue(Clazz clazz,
InvokeDynamicConstant invokeDynamicConstant,
java.lang.String type)
Returns the return value of the specified method.
|
void |
invokeMember(Clazz clazz,
Method method,
CodeAttribute codeAttribute,
int offset,
ConstantInstruction constantInstruction,
Stack stack,
Variables variables)
Updates the given stack corresponding to the execution of the given
field or method reference instruction.
|
protected boolean |
methodMayHaveSideEffects(Clazz clazz,
AnyMethodrefConstant anyMethodrefConstant,
java.lang.String returnType)
Returns true if the method itself can modify the stack/variables and therefore
needs to be executed even if it returns void.
|
abstract void |
setFieldClassValue(Clazz clazz,
FieldrefConstant fieldrefConstant,
ReferenceValue value)
Sets the class through which the specified field is accessed.
|
abstract void |
setFieldValue(Clazz clazz,
FieldrefConstant fieldrefConstant,
Value value)
Sets the value of the specified field.
|
abstract void |
setMethodParameterValue(Clazz clazz,
AnyMethodrefConstant anyMethodrefConstant,
int parameterIndex,
Value value)
Sets the value of the specified method parameter.
|
abstract void |
setMethodReturnValue(Clazz clazz,
Method method,
Value value)
Sets the return value of the specified method.
|
void |
visitAnyMethodrefConstant(Clazz clazz,
AnyMethodrefConstant anyMethodrefConstant)
Visits any RefConstant instance.
|
void |
visitFieldrefConstant(Clazz clazz,
FieldrefConstant fieldrefConstant) |
void |
visitInvokeDynamicConstant(Clazz clazz,
InvokeDynamicConstant invokeDynamicConstant) |
void |
visitParameter(Clazz clazz,
Member member,
int parameterIndex,
int parameterCount,
int parameterOffset,
int parameterSize,
java.lang.String parameterType,
Clazz referencedClass)
Visits the given parameter.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvisitAnyConstant, visitAnyRefConstant, visitClassConstant, visitDoubleConstant, visitDynamicConstant, visitFloatConstant, visitIntegerConstant, visitInterfaceMethodrefConstant, visitLongConstant, visitMethodHandleConstant, visitMethodrefConstant, visitMethodTypeConstant, visitModuleConstant, visitNameAndTypeConstant, visitPackageConstant, visitPrimitiveArrayConstant, visitStringConstant, visitUtf8Constantprotected Variables variables
protected boolean isStatic
protected boolean isLoad
protected Stack stack
protected Method method
public void enterMethod(Clazz clazz, Method method, Variables variables)
InvocationUnitenterMethod in interface InvocationUnitpublic void visitParameter(Clazz clazz, Member member, int parameterIndex, int parameterCount, int parameterOffset, int parameterSize, java.lang.String parameterType, Clazz referencedClass)
ParameterVisitorvisitParameter in interface ParameterVisitorclazz - the class of the method.member - the field or method of the parameter.parameterIndex - the index of the parameter.parameterCount - the total number of parameters.parameterOffset - the offset of the parameter, accounting for
longs and doubles taking up two entries.parameterSize - the total size of the parameters, accounting for
longs and doubles taking up two entries.parameterType - the parameter type.referencedClass - the class contained in the parameter type, if any.public void exitMethod(Clazz clazz, Method method, Value returnValue)
InvocationUnitexitMethod in interface InvocationUnitpublic void enterExceptionHandler(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, int catchType, Stack stack)
InvocationUnitenterExceptionHandler in interface InvocationUnitpublic void invokeMember(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction, Stack stack, Variables variables)
InvocationUnitinvokeMember in interface InvocationUnitpublic void visitFieldrefConstant(Clazz clazz, FieldrefConstant fieldrefConstant)
visitFieldrefConstant in interface ConstantVisitorpublic void visitAnyMethodrefConstant(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant)
ConstantVisitorvisitAnyMethodrefConstant in interface ConstantVisitorpublic void visitInvokeDynamicConstant(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant)
visitInvokeDynamicConstant in interface ConstantVisitorpublic abstract Value getExceptionValue(Clazz clazz, ClassConstant catchClassConstant)
public abstract void setFieldClassValue(Clazz clazz, FieldrefConstant fieldrefConstant, ReferenceValue value)
public abstract Value getFieldClassValue(Clazz clazz, FieldrefConstant fieldrefConstant, java.lang.String type)
public abstract void setFieldValue(Clazz clazz, FieldrefConstant fieldrefConstant, Value value)
public abstract Value getFieldValue(Clazz clazz, FieldrefConstant fieldrefConstant, java.lang.String type)
public abstract void setMethodParameterValue(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, int parameterIndex, Value value)
public abstract Value getMethodParameterValue(Clazz clazz, Method method, int parameterIndex, java.lang.String type, Clazz referencedClass)
public abstract void setMethodReturnValue(Clazz clazz, Method method, Value value)
public abstract Value getMethodReturnValue(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, java.lang.String type)
public abstract Value getMethodReturnValue(Clazz clazz, InvokeDynamicConstant invokeDynamicConstant, java.lang.String type)
protected boolean methodMayHaveSideEffects(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, java.lang.String returnType)