类 ReflectionExecutor

java.lang.Object
proguard.evaluation.executor.ReflectionExecutor
所有已实现的接口:
Executor
直接已知子类:
StringReflectionExecutor

public abstract class ReflectionExecutor extends Object implements Executor
This Executor provides an implementation for Executor.getMethodResult(proguard.evaluation.executor.MethodExecutionInfo, proguard.evaluation.ValueCalculator) which tries to resolve the method at runtime and execute it using Java's reflection API java.lang.reflect.
  • 构造器详细资料

    • ReflectionExecutor

      public ReflectionExecutor()
  • 方法详细资料

    • getMethodResult

      public MethodResult getMethodResult(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
      从接口复制的说明: Executor
      Calculate the result of a given method. This is the return value for a non-constructor method (null if it returns void) 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 a Model) to the appropriate Value used 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 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 - The ReferenceValue of 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.