Class AnalyzedObjectFactory

java.lang.Object
proguard.evaluation.value.object.AnalyzedObjectFactory

public class AnalyzedObjectFactory extends Object
Factory methods to create AnalyzedObject.
  • Method Details

    • create

      public static AnalyzedObject create(@Nullable @Nullable Object value, @Nullable @Nullable String type, @Nullable @Nullable Clazz referencedClass)
      Create a AnalyzedObject, representing the tracked value for a reference type. If an object is created successfully it is guaranteed to be modeled if the passed value was an instance of Model.

      Consistency checks on the arguments are performed:

      • If "value" is null and "referencedClass" isn't, "type" should match the type of "referencedClass"
      • If "type" represents a primitive type or primitive array "referencedClass" should be null
      • If "referencedClass" is not null, the type of "value" (or of the type modeled by "value" if it is a Model) has to be the same type of "referencedClass" or of a class inheriting from it.
      • If "referencedClass" is null, "type" needs to match the type of "value" (or of the type modeled by "value" if it is a Model)
      Parameters:
      value - the value of the tracked object. Can be the actual value or a Model. null iff the tracked value is null
      type - the type of the value. This should be the static type specified in the method signature, might not correspond to the type returned by the created AnalyzedObject.getType() because dynamic typing might be taken into consideration.
      referencedClass - the class referenced when the value is created (e.g., the class of the return value of a method call). Always null for primitive types (or arrays of primitive); can be null if the library class pool is missing or the class pool references have not been initialized; can also be null in some cases even if everything has been initialized. For this reason this is used just for sanity checks when not-null, while it being null is not considered in any way as something incorrect.
    • createPrecise

      public static AnalyzedObject createPrecise(@NotNull @NotNull Object value)
      Create a precise object wrapping the value.
      Parameters:
      value - The wrapped value
    • createModeled

      public static AnalyzedObject createModeled(@NotNull @NotNull Model value)
      Create an object the value of which is modeled.
      Parameters:
      value - The wrapped model
    • createNullOfType

      public static AnalyzedObject createNullOfType(@NotNull @NotNull String type)
      Create an object with null value and known type.
      Parameters:
      type - The known type of the null object
    • createNull

      public static AnalyzedObject createNull()
      Create an object with unknown type and null value.
    • createDetailedArray

      public static AnalyzedObject createDetailedArray(Value[] values, String type)
      Create a modeled object representing a detailed array (i.e., it's model is a ArrayModel.