proguard.evaluation
Class BasicInvocationUnit

java.lang.Object
  extended by proguard.classfile.util.SimplifiedVisitor
      extended by proguard.evaluation.BasicInvocationUnit
All Implemented Interfaces:
ConstantVisitor, MemberVisitor, InvocationUnit
Direct Known Subclasses:
LoadingInvocationUnit, StoringInvocationUnit

public class BasicInvocationUnit
extends SimplifiedVisitor
implements InvocationUnit, ConstantVisitor, MemberVisitor

This InvocationUnit sets up the variables for entering a method, and it updates the stack for the invocation of a class member, using simple values.


Field Summary
protected  ValueFactory valueFactory
           
 
Constructor Summary
BasicInvocationUnit(ValueFactory valueFactory)
          Creates a new BasicInvocationUnit with the given value factory.
 
Method Summary
 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.
protected  Value getFieldClassValue(Clazz clazz, RefConstant refConstant, java.lang.String type)
          Returns the class though which the specified field is accessed.
protected  Value getFieldValue(Clazz clazz, RefConstant refConstant, java.lang.String type)
          Returns the value of the specified field.
protected  Value getMethodParameterValue(Clazz clazz, Method method, int parameterIndex, java.lang.String type, Clazz referencedClass)
          Returns the value of the specified method parameter.
protected  Value getMethodReturnValue(Clazz clazz, RefConstant refConstant, 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)
          Updates the given stack corresponding to the execution of the given field or method reference instruction.
protected  void setFieldClassValue(Clazz clazz, RefConstant refConstant, ReferenceValue value)
          Sets the class through which the specified field is accessed.
protected  void setFieldValue(Clazz clazz, RefConstant refConstant, Value value)
          Sets the value of the specified field.
protected  void setMethodParameterValue(Clazz clazz, RefConstant refConstant, int parameterIndex, Value value)
          Sets the value of the specified method parameter.
protected  void setMethodReturnValue(Clazz clazz, Method method, Value value)
          Sets the return value of the specified method.
 void visitAnyMethodrefConstant(Clazz clazz, RefConstant methodrefConstant)
          Visits any type of method RefConstant of the given class.
 void visitFieldrefConstant(Clazz clazz, FieldrefConstant fieldrefConstant)
           
 void visitLibraryField(LibraryClass programClass, LibraryField programField)
           
 void visitLibraryMethod(LibraryClass programClass, LibraryMethod programMethod)
           
 void visitProgramField(ProgramClass programClass, ProgramField programField)
           
 void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
           
 
Methods inherited from class proguard.classfile.util.SimplifiedVisitor
visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotationDefaultAttribute, visitAnnotationElementValue, visitAnyAnnotationsAttribute, visitAnyAttribute, visitAnyClass, visitAnyConstant, visitAnyElementValue, visitAnyInstruction, visitAnyMember, visitAnyParameterAnnotationsAttribute, visitAnyRefConstant, visitAnyStackMapFrame, visitAnySwitchInstruction, visitAnyVerificationType, visitArrayElementValue, visitBranchInstruction, visitClassConstant, visitClassElementValue, visitCodeAttribute, visitConstantElementValue, visitConstantInstruction, visitConstantValueAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDoubleConstant, visitDoubleType, visitEnclosingMethodAttribute, visitEnumConstantElementValue, visitExceptionsAttribute, visitFloatConstant, visitFloatType, visitFullFrame, visitInnerClassesAttribute, visitIntegerConstant, visitIntegerType, visitInterfaceMethodrefConstant, visitLessZeroFrame, visitLibraryClass, visitLibraryMember, visitLineNumberTableAttribute, visitLocalVariableTableAttribute, visitLocalVariableTypeTableAttribute, visitLongConstant, visitLongType, visitLookUpSwitchInstruction, visitMethodrefConstant, visitMoreZeroFrame, visitNameAndTypeConstant, visitNullType, visitObjectType, visitProgramClass, visitProgramMember, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleParameterAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleParameterAnnotationsAttribute, visitSameOneFrame, visitSameZeroFrame, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSimpleInstruction, visitSourceDirAttribute, visitSourceFileAttribute, visitStackDoubleType, visitStackFloatType, visitStackIntegerType, visitStackLongType, visitStackMapAttribute, visitStackMapTableAttribute, visitStackNullType, visitStackObjectType, visitStackTopType, visitStackUninitializedThisType, visitStackUninitializedType, visitStringConstant, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitTableSwitchInstruction, visitTopType, visitUninitializedThisType, visitUninitializedType, visitUnknownAttribute, visitUtf8Constant, visitVariableInstruction, visitVariablesDoubleType, visitVariablesFloatType, visitVariablesIntegerType, visitVariablesLongType, visitVariablesNullType, visitVariablesObjectType, visitVariablesTopType, visitVariablesUninitializedThisType, visitVariablesUninitializedType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface proguard.classfile.constant.visitor.ConstantVisitor
visitClassConstant, visitDoubleConstant, visitFloatConstant, visitIntegerConstant, visitInterfaceMethodrefConstant, visitLongConstant, visitMethodrefConstant, visitNameAndTypeConstant, visitStringConstant, visitUtf8Constant
 

Field Detail

valueFactory

protected final ValueFactory valueFactory
Constructor Detail

BasicInvocationUnit

public BasicInvocationUnit(ValueFactory valueFactory)
Creates a new BasicInvocationUnit with the given value factory.

Method Detail

enterMethod

public void enterMethod(Clazz clazz,
                        Method method,
                        Variables variables)
Description copied from interface: InvocationUnit
Sets up the given variables for entering the given method.

Specified by:
enterMethod in interface InvocationUnit

exitMethod

public void exitMethod(Clazz clazz,
                       Method method,
                       Value returnValue)
Description copied from interface: InvocationUnit
Exits the given method with the given return value.

Specified by:
exitMethod in interface InvocationUnit

invokeMember

public void invokeMember(Clazz clazz,
                         Method method,
                         CodeAttribute codeAttribute,
                         int offset,
                         ConstantInstruction constantInstruction,
                         Stack stack)
Description copied from interface: InvocationUnit
Updates the given stack corresponding to the execution of the given field or method reference instruction.

Specified by:
invokeMember in interface InvocationUnit

visitFieldrefConstant

public void visitFieldrefConstant(Clazz clazz,
                                  FieldrefConstant fieldrefConstant)
Specified by:
visitFieldrefConstant in interface ConstantVisitor
Overrides:
visitFieldrefConstant in class SimplifiedVisitor

visitAnyMethodrefConstant

public void visitAnyMethodrefConstant(Clazz clazz,
                                      RefConstant methodrefConstant)
Description copied from class: SimplifiedVisitor
Visits any type of method RefConstant of the given class.

Overrides:
visitAnyMethodrefConstant in class SimplifiedVisitor

setFieldClassValue

protected void setFieldClassValue(Clazz clazz,
                                  RefConstant refConstant,
                                  ReferenceValue value)
Sets the class through which the specified field is accessed.


getFieldClassValue

protected Value getFieldClassValue(Clazz clazz,
                                   RefConstant refConstant,
                                   java.lang.String type)
Returns the class though which the specified field is accessed.


setFieldValue

protected void setFieldValue(Clazz clazz,
                             RefConstant refConstant,
                             Value value)
Sets the value of the specified field.


getFieldValue

protected Value getFieldValue(Clazz clazz,
                              RefConstant refConstant,
                              java.lang.String type)
Returns the value of the specified field.


setMethodParameterValue

protected void setMethodParameterValue(Clazz clazz,
                                       RefConstant refConstant,
                                       int parameterIndex,
                                       Value value)
Sets the value of the specified method parameter.


getMethodParameterValue

protected Value getMethodParameterValue(Clazz clazz,
                                        Method method,
                                        int parameterIndex,
                                        java.lang.String type,
                                        Clazz referencedClass)
Returns the value of the specified method parameter.


setMethodReturnValue

protected void setMethodReturnValue(Clazz clazz,
                                    Method method,
                                    Value value)
Sets the return value of the specified method.


getMethodReturnValue

protected Value getMethodReturnValue(Clazz clazz,
                                     RefConstant refConstant,
                                     java.lang.String type)
Returns the return value of the specified method.


visitProgramField

public void visitProgramField(ProgramClass programClass,
                              ProgramField programField)
Specified by:
visitProgramField in interface MemberVisitor
Overrides:
visitProgramField in class SimplifiedVisitor

visitProgramMethod

public void visitProgramMethod(ProgramClass programClass,
                               ProgramMethod programMethod)
Specified by:
visitProgramMethod in interface MemberVisitor
Overrides:
visitProgramMethod in class SimplifiedVisitor

visitLibraryField

public void visitLibraryField(LibraryClass programClass,
                              LibraryField programField)
Specified by:
visitLibraryField in interface MemberVisitor
Overrides:
visitLibraryField in class SimplifiedVisitor

visitLibraryMethod

public void visitLibraryMethod(LibraryClass programClass,
                               LibraryMethod programMethod)
Specified by:
visitLibraryMethod in interface MemberVisitor
Overrides:
visitLibraryMethod in class SimplifiedVisitor