Class MethodResult

java.lang.Object
proguard.evaluation.MethodResult

public class MethodResult extends Object
A class modeling the results of a method invocation. This includes the returned value and whether any side effect happened either on the calling instance or one of the arguments.

In case of side effects the new value should have a reference identifier corresponding to the original argument. If the analysis supports it, this information can be used to replace all the values with the same reference value with the updated one.

  • Method Details

    • invalidResult

      public static MethodResult invalidResult()
      Returns a result communicating to the receiver that the creator is not able to provide any additional information about the method execution.

      This should be the only way to communicate this type of information, while any other result with all empty parameters means a method returning void and with no side effects.

      Returns:
      an invalid result.
    • isResultValid

      public boolean isResultValid()
      Returns whether the result is invalid (i.e., whether it was created via invalidResult()).
      Returns:
      whether the result is invalid.
    • isReturnValuePresent

      public boolean isReturnValuePresent()
      Whether the result provides a return value. We need to specify this since null is a valid return value.
      Returns:
      whether the result provides a return value.
    • isInstanceUpdated

      public boolean isInstanceUpdated()
      Whether the calling instance was updated during method execution.
      Returns:
      whether the calling instance was updated during method execution.
    • isAnyParameterUpdated

      public boolean isAnyParameterUpdated()
      Whether any parameter was updated during method execution.
      Returns:
      whether any parameter was updated during method execution.
    • getReturnValue

      @Nullable public @Nullable Value getReturnValue()
      The return value of the method invocation if isReturnValuePresent, throws otherwise.
      Returns:
      the return value of the method invocation.
    • getUpdatedInstance

      @Nullable public @Nullable ReferenceValue getUpdatedInstance()
      The updated instance value after a method invocation if isInstanceUpdated(), throws otherwise.

      The identifier of the returned value can be matched to identify the old values using the same reference.

      Returns:
      the updated instance value after a method invocation.
    • getUpdatedParameters

      @Nullable public @Nullable List<Value> getUpdatedParameters()
      The updated parameter value after a method invocation if isAnyParameterUpdated(), throws otherwise.

      Each element of the list (corresponding to the parameter position, instance not included and the first parameter is always element 0) contains either null, if the specific parameter was not updated, or the updated parameter value.

      The identifier of the returned values can be matched to identify the old values using the same reference.

      Returns:
      the updated parameters value after a method invocation.