Package proguard.evaluation.executor
Class JavaReflectionApiExecutor
- java.lang.Object
-
- proguard.evaluation.executor.JavaReflectionApiExecutor
-
- All Implemented Interfaces:
Executor
public class JavaReflectionApiExecutor extends java.lang.Object implements Executor
ThisExecutor
provides an implementation forExecutor.getMethodResult(proguard.evaluation.executor.MethodExecutionInfo, proguard.evaluation.ValueCalculator)
which resolves a number of simpleClass
andClassLoader
API methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JavaReflectionApiExecutor.Builder
Builder forJavaReflectionApiExecutor
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodResult
getMethodResult(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
Calculate the result of a given method.java.util.Set<MethodSignature>
getSupportedMethodSignatures()
Get a list of method signatures that indicate which methods are supported by this executor.
-
-
-
Method Detail
-
getMethodResult
public MethodResult getMethodResult(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
Description copied from interface:Executor
Calculate 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.- Specified by:
getMethodResult
in interfaceExecutor
- Parameters:
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 appropriateValue
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).- Returns:
- 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.
-
getSupportedMethodSignatures
public java.util.Set<MethodSignature> getSupportedMethodSignatures()
Description copied from interface:Executor
Get a list of method signatures that indicate which methods are supported by this executor.The returned methods should be exactly the ones that the executor is expected to be able to handle. The invocation unit does not make any additional assumption on the executors available to execute a method and will match them iff the signature of the target method matches exactly.
Only full method signatures should be returned, the invocation unit does not support wildcards.
- Specified by:
getSupportedMethodSignatures
in interfaceExecutor
- Returns:
- a set of methods the executor can handle.
-
-