类 ExecutingInvocationUnit
- java.lang.Object
-
- proguard.evaluation.SimplifiedInvocationUnit
-
- proguard.evaluation.BasicInvocationUnit
-
- proguard.evaluation.ExecutingInvocationUnit
-
- 所有已实现的接口:
ConstantVisitor,MemberVisitor,ParameterVisitor,InvocationUnit
public class ExecutingInvocationUnit extends BasicInvocationUnit
ThisInvocationUnitis 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
ExecutingInvocationUnitdelegates the acquisition of method results and certain other decisions (e.g. whether replacing references in the stack and variables is needed) to itsExecutors. Per default, an instance of this class will have access to aStringReflectionExecutorthat handles methods ofString,StringBuilderandStringBuffer. TheExecutingInvocationUnit.Builder, allows for disabling the defaultStringReflectionExecutorand adding otherExecutors.
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classExecutingInvocationUnit.BuilderBuilds anExecutingInvocationUnit.
-
字段概要
-
从类继承的字段 proguard.evaluation.BasicInvocationUnit
valueFactory
-
-
构造器概要
构造器 限定符 构造器 说明 protectedExecutingInvocationUnit(@NotNull ClassPool programClassPool, @NotNull ClassPool libraryClassPool, ValueFactory valueFactory, boolean enableSameInstanceIdApproximation, boolean allowNonFinalConstants, java.util.List<Executor> registeredExecutors)Creates anExecutingInvocationUnit.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleancanExecute(@NotNull MethodSignature signature)Returns whether the invocation unit is able to handle the given method.MethodResultexecuteMethod(ConcreteCall call, Value... parameters)Execute the method given by aConcreteCall.MethodResultexecuteMethod(Executor executor, MethodExecutionInfo methodInfo)Executes a method using a givenExecutor.ValuegetFieldValue(Clazz clazz, FieldrefConstant fieldrefConstant, java.lang.String type)Returns the value of the specified field.ValuegetMethodReturnValue(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, java.lang.String returnType)Returns the return value of the specified method.booleanmethodMayHaveSideEffects(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.voidsetMethodParameterValue(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant, int parameterIndex, Value value)Sets the value of the specified method parameter.booleansupportsAnyMethodOf(@NotNull java.lang.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, java.util.List<Executor> registeredExecutors)Creates anExecutingInvocationUnit.
-
-
方法详细资料
-
visitAnyMethodrefConstant
public void visitAnyMethodrefConstant(Clazz clazz, AnyMethodrefConstant anyMethodrefConstant)
从接口复制的说明: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, java.lang.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, java.lang.String returnType)
从类复制的说明:SimplifiedInvocationUnitReturns the return value of the specified method.
-
executeMethod
public MethodResult executeMethod(ConcreteCall call, Value... parameters)
Execute the method given by aConcreteCall. SeeexecuteMethod(Executor, MethodExecutionInfo)- 参数:
call- The concrete call.parameters- The calling parameters.- 返回:
- The method result value.
-
executeMethod
public MethodResult executeMethod(Executor executor, MethodExecutionInfo methodInfo)
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
public boolean canExecute(@NotNull @NotNull MethodSignature signature)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
public boolean supportsAnyMethodOf(@NotNull @NotNull Clazz clazz)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
public boolean supportsAnyMethodOf(@NotNull @NotNull java.lang.String className)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
public Value getFieldValue(Clazz clazz, FieldrefConstant fieldrefConstant, java.lang.String type)
从类复制的说明:SimplifiedInvocationUnitReturns the value of the specified field.- 覆盖:
getFieldValue在类中BasicInvocationUnit
-
-