类 ReflectionExecutor
- java.lang.Object
-
- proguard.evaluation.executor.ReflectionExecutor
-
- 所有已实现的接口:
Executor
- 直接已知子类:
StringReflectionExecutor
public abstract class ReflectionExecutor extends java.lang.Object implements Executor
ThisExecutorprovides an implementation forExecutor.getMethodResult(proguard.evaluation.executor.MethodExecutionInfo, proguard.evaluation.ValueCalculator)which tries to resolve the method at runtime and execute it using Java's reflection APIjava.lang.reflect.
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classReflectionExecutor.InstanceCopyResult-
从接口继承的嵌套类/接口 proguard.evaluation.executor.Executor
Executor.Builder<T extends Executor>
-
-
构造器概要
构造器 构造器 说明 ReflectionExecutor()
-
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected abstract ExecutorInstanceHandlergetDefaultInstanceHandler()Provides a default instance handler used by the executor in case the reflective execution fails.protected abstract java.util.Optional<ReflectionExecutor.InstanceCopyResult>getInstanceOrCopyIfMutable(ReferenceValue instanceValue)Get an object which will act as the calling instance.MethodResultgetMethodResult(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)Calculate the result of a given method.-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 proguard.evaluation.executor.Executor
getSupportedMethodSignatures
-
-
-
-
方法详细资料
-
getMethodResult
public MethodResult getMethodResult(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
从接口复制的说明:ExecutorCalculate the result of a given method. This is the return value for a non-constructor method (null if it returnsvoid ) and the instantiated object for a constructor.- 指定者:
getMethodResult在接口中Executor- 参数:
methodExecutionInfo- Information about the called method.valueCalculator- a function mapping the result of a method invocation (can be an Object with the result if the executor calculates a real value or aModel) to the appropriateValueused by the analysis. Should also be used to create values of unknown value since the executor might be able to provide additional information on them even if the value itself is not known (e.g., on the identifier of the returned value).- 返回:
- The result of the method call, including information on the returned value or values or
arguments on which side effects happened during the method execution. If the executor is
not able to provide any additional information for any reason the returned value should be
MethodResult.invalidResult(), so that the caller can know that execution failed and just provide its best approximation of the result.
-
getInstanceOrCopyIfMutable
protected abstract java.util.Optional<ReflectionExecutor.InstanceCopyResult> getInstanceOrCopyIfMutable(ReferenceValue instanceValue)
Get an object which will act as the calling instance. If we know that executing the method does not modify the instance this can just be the same value. Otherwise, a copy should be returned in order to not change the reference whose state may be of interest at the end of an analysis.- 参数:
instanceValue- TheReferenceValueof the instance.- 返回:
- The new calling instance.
-
getDefaultInstanceHandler
protected abstract ExecutorInstanceHandler getDefaultInstanceHandler()
Provides a default instance handler used by the executor in case the reflective execution fails.The handler carries information on whether a method returns the same object as its instance.
- 返回:
- the default instance handler.
-
-