public abstract class ReflectionExecutor extends java.lang.Object implements Executor
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
.Modifier and Type | Class and Description |
---|---|
static class |
ReflectionExecutor.InstanceCopyResult |
Executor.Builder<T extends Executor>
Constructor and Description |
---|
ReflectionExecutor() |
Modifier and Type | Method and Description |
---|---|
protected abstract ExecutorInstanceHandler |
getDefaultInstanceHandler()
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.
|
MethodResult |
getMethodResult(MethodExecutionInfo methodExecutionInfo,
ValueCalculator valueCalculator)
Calculate the result of a given method.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSupportedMethodSignatures
public MethodResult getMethodResult(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
Executor
getMethodResult
in interface 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).MethodResult.invalidResult()
, so that the caller can know that execution failed and
just provide its best approximation of the result.protected abstract java.util.Optional<ReflectionExecutor.InstanceCopyResult> getInstanceOrCopyIfMutable(ReferenceValue instanceValue)
instanceValue
- The ReferenceValue
of the instance.protected abstract ExecutorInstanceHandler getDefaultInstanceHandler()
The handler carries information on whether a method returns the same object as its instance.