Class MethodResult.Builder
- java.lang.Object
-
- proguard.evaluation.MethodResult.Builder
-
- Enclosing class:
- MethodResult
public static class MethodResult.Builder extends java.lang.Object
A builder forMethodResult
. A value should be set only if the creator is able to provide that information.setReturnValue(Value)
should not be called if the method returns void or if no return value can be provided (if the method execution failsMethodResult.invalidResult()
should be used instead of the builder). SimilarlysetUpdatedInstance(ReferenceValue)
andsetUpdatedParameters(List)
being used means that there really were side effects on respectively instance or parameters during the analyzed method invocation; this methods should not be used if no side effects happen.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodResult
build()
Builds aMethodResult
given the set parameters.MethodResult.Builder
setReturnValue(@Nullable Value returnValue)
Sets the value returned by the analyzed method.MethodResult.Builder
setUpdatedInstance(@NotNull ReferenceValue updatedInstance)
Set the updated value of the invocation instance after the invocation of the analyzed method.MethodResult.Builder
setUpdatedParameters(java.util.List<Value> updatedParameters)
Set the updated value of the parameters after the invocation of the analyzed method.
-
-
-
Method Detail
-
setReturnValue
public MethodResult.Builder setReturnValue(@Nullable @Nullable Value returnValue)
Sets the value returned by the analyzed method.Should not be invoked for methods returning void.
- Parameters:
returnValue
- the return value of an analyzed method.- Returns:
- the builder.
-
setUpdatedInstance
public MethodResult.Builder setUpdatedInstance(@NotNull @NotNull ReferenceValue updatedInstance)
Set the updated value of the invocation instance after the invocation of the analyzed method.Should not be invoked if there were no side effects on the calling instance during the method execution.
Should always be used for setting the result of a constructor's invocation.
The caller should make sure the updated instance to have the same reference identifier of the old instance.
- Parameters:
updatedInstance
- the instance updated during the analyzed method's invocation.- Returns:
- the builder.
-
setUpdatedParameters
public MethodResult.Builder setUpdatedParameters(java.util.List<Value> updatedParameters)
Set the updated value of the parameters after the invocation of the analyzed method.Should not be invoked if there were no side effects on the parameters during the method execution.
The caller should make sure the updated parameters to have the same reference identifier of the old ones.
- Parameters:
updatedParameters
- the parameters updated during the analyzed method's invocation. The size of the list should be the same as the number of parameters of the analyzed method excluded the calling instance (the first parameter is always in position 0 for both instance and static methods). Each parameter should be null if it was not updated, the updated value otherwise.- Returns:
- the builder.
-
build
public MethodResult build()
Builds aMethodResult
given the set parameters.- Returns:
- the new
MethodResult
.
-
-