类 ExecutingInvocationUnit
- 所有已实现的接口:
ConstantVisitor,MemberVisitor,ParameterVisitor,InvocationUnit
InvocationUnit is capable of executing the invoked methods with particular values as
parameters.
If a method has a return value, this value is determined and supplied as a particular Value. Methods that operate on an instance are able to modify the calling instance. For such
methods, references in the stack and variables to that instance are replaced with the modified
one. This also applies to constructors.
This class is responsible for creating the final particular Values for methods that
were handled without errors and creating fallback values in case the method could not be handled.
It also performs the action of replacing references of instances that changed in the stack and
variables if needed. This is however limited as we only update the instance if it was modified
and ignores all other parameters which might have changed too.
An ExecutingInvocationUnit delegates the acquisition of method results and certain
other decisions (e.g. whether replacing references in the stack and variables is needed) to its
Executors. Per default, an instance of this class will have access to a StringReflectionExecutor that handles methods of String, StringBuilder and
StringBuffer. The ExecutingInvocationUnit.Builder, allows for disabling the default StringReflectionExecutor and adding other Executors.
-
嵌套类概要
嵌套类 -
字段概要
从类继承的字段 proguard.evaluation.BasicInvocationUnit
valueFactory -
构造器概要
构造器限定符构造器说明protectedExecutingInvocationUnit(@NotNull ClassPool programClassPool, @NotNull ClassPool libraryClassPool, ValueFactory valueFactory, boolean enableSameInstanceIdApproximation, boolean allowNonFinalConstants, List<Executor> registeredExecutors) Creates anExecutingInvocationUnit. -
方法概要
修饰符和类型方法说明booleancanExecute(@NotNull MethodSignature signature) Returns whether the invocation unit is able to handle the given method.executeMethod(ConcreteCall call, Value... parameters) Execute the method given by aConcreteCall.executeMethod(Executor executor, MethodExecutionInfo methodInfo) Executes a method using a givenExecutor.getFieldValue(Clazz clazz, FieldrefConstant fieldrefConstant, String type) Returns the value of the specified field.getMethodReturnValue(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, String returnType) Returns the return value of the specified method.booleanmethodMayHaveSideEffects(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, String returnType) Returns true if the method itself can modify the stack/variables and therefore needs to be executed even if it returns void.voidsetMethodParameterValue(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, int parameterIndex, Value value) Sets the value of the specified method parameter.booleansupportsAnyMethodOf(@NotNull String className) Checks whether any method of the given class is supported by the executors.booleansupportsAnyMethodOf(@NotNull Clazz clazz) Checks whether any method of the given class is supported by the executors.voidvisitAnyMethodrefConstant(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant) Visits any RefConstant instance.从类继承的方法 proguard.evaluation.BasicInvocationUnit
getExceptionValue, getFieldClassValue, getMethodParameterValue, getMethodReturnValue, setFieldClassValue, setFieldValue, setMethodReturnValue, visitLibraryField, visitLibraryMethod, visitProgramField, visitProgramMethod从类继承的方法 proguard.evaluation.SimplifiedInvocationUnit
enterExceptionHandler, enterMethod, exitMethod, invokeMember, visitFieldrefConstant, visitInvokeDynamicConstant, visitParameter从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 proguard.classfile.constant.visitor.ConstantVisitor
visitAnyConstant, visitAnyRefConstant, visitClassConstant, visitDoubleConstant, visitDynamicConstant, visitFloatConstant, visitIntegerConstant, visitInterfaceMethodrefConstant, visitLongConstant, visitMethodHandleConstant, visitMethodrefConstant, visitMethodTypeConstant, visitModuleConstant, visitNameAndTypeConstant, visitPackageConstant, visitPrimitiveArrayConstant, visitStringConstant, visitUtf8Constant从接口继承的方法 proguard.evaluation.InvocationUnit
enterExceptionHandler, enterMethod, exitMethod, invokeMember从接口继承的方法 proguard.classfile.visitor.MemberVisitor
visitAnyMember, visitLibraryMember, visitProgramMember
-
构造器详细资料
-
ExecutingInvocationUnit
protected ExecutingInvocationUnit(@NotNull @NotNull ClassPool programClassPool, @NotNull @NotNull ClassPool libraryClassPool, ValueFactory valueFactory, boolean enableSameInstanceIdApproximation, boolean allowNonFinalConstants, List<Executor> registeredExecutors) Creates anExecutingInvocationUnit.
-
-
方法详细资料
-
visitAnyMethodrefConstant
从接口复制的说明:ConstantVisitorVisits any RefConstant instance. The more specific default implementations of this interface delegate to this method. -
setMethodParameterValue
public void setMethodParameterValue(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, int parameterIndex, Value value) 从类复制的说明:SimplifiedInvocationUnitSets the value of the specified method parameter. -
methodMayHaveSideEffects
public boolean methodMayHaveSideEffects(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, String returnType) 从类复制的说明:SimplifiedInvocationUnitReturns true if the method itself can modify the stack/variables and therefore needs to be executed even if it returns void. -
getMethodReturnValue
public Value getMethodReturnValue(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, String returnType) 从类复制的说明:SimplifiedInvocationUnitReturns the return value of the specified method. -
executeMethod
Execute the method given by aConcreteCall. SeeexecuteMethod(Executor, MethodExecutionInfo)- 参数:
call- The concrete call.parameters- The calling parameters.- 返回:
- The method result value.
-
executeMethod
Executes a method using a givenExecutor. Replace references of the instance in variables and stack if necessary. The return value represents the result of the executed method.- 参数:
executor- TheExecutorwhich handles this method call.methodInfo- Information about the method to execute.- 返回:
- The method result value.
-
canExecute
Returns whether the invocation unit is able to handle the given method.- 参数:
signature- The method signature of the method being tested- 返回:
- true if the method can be executed.
-
supportsAnyMethodOf
Checks whether any method of the given class is supported by the executors.- 参数:
clazz- The class to check- 返回:
- true if any method of the given class is supported by the executor
-
supportsAnyMethodOf
Checks whether any method of the given class is supported by the executors.- 参数:
className- The class name to check- 返回:
- true if any method of the given class is supported by the executor
-
getFieldValue
从类复制的说明:SimplifiedInvocationUnitReturns the value of the specified field.- 覆盖:
getFieldValue在类中BasicInvocationUnit
-