Package soot

Class ArrayType

  • All Implemented Interfaces:
    Serializable, Numberable, Switchable

    public class ArrayType
    extends RefLikeType
    A class that models Java's array types. ArrayTypes are parameterized by a Type and and an integer representing the array's dimension count. Two ArrayType are 'equal' if they are parameterized equally.
    See Also:
    Serialized Form
    • Field Detail

      • baseType

        public final Type baseType
        baseType can be any type except for an array type, null and void What is the base type of the array? That is, for an array of type A[][][], how do I find out what the A is? The accepted way of doing this has always been to look at the public field baseType in ArrayType, ever since the very beginning of Soot.
      • numDimensions

        public final int numDimensions
        dimension count for the array type
    • Method Detail

      • v

        public static ArrayType v​(Type baseType,
                                  int numDimensions)
        Creates an ArrayType parameterized by a given Type and dimension count.
        Parameters:
        baseType - a Type to parameterize the ArrayType
        numDimensions - the dimension count to parameterize the ArrayType.
        Returns:
        an ArrayType parameterized accordingly.
      • equals

        public boolean equals​(Object t)
        Two ArrayType are 'equal' if they are parameterized identically. (ie have same Type and dimension count.
        Overrides:
        equals in class Object
        Parameters:
        t - object to test for equality
        Returns:
        true if t is an ArrayType and is parameterized identically to this.
      • toString

        public String toString()
        Description copied from class: Type
        Returns a textual representation of this type.
        Specified by:
        toString in class Type
      • toQuotedString

        public String toQuotedString()
        Returns a textual representation, quoted as needed, of this type for serialization, e.g. to .jimple format
        Overrides:
        toQuotedString in class Type
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • apply

        public void apply​(Switch sw)
        Description copied from class: Type
        Method required for use of Switchable.
        Specified by:
        apply in interface Switchable
        Overrides:
        apply in class Type
      • getArrayElementType

        public Type getArrayElementType()
        If I have a variable x of declared type t, what is a good declared type for the expression ((Object[]) x)[i]? The getArrayElementType() method in RefLikeType was introduced to answer this question for all classes implementing RefLikeType. If t is an array, then the answer is the same as getElementType(). But t could also be Object, Serializable, or Cloneable, which can all hold any array, so then the answer is Object.
        Specified by:
        getArrayElementType in class RefLikeType
      • getElementType

        public Type getElementType()
        If I get an element of the array, what will be its type? That is, if I have an array a of type A[][][], what is the type of a[] (it's A[][])? The getElementType() method in ArrayType was introduced to answer this question.
      • isAllowedInFinalCode

        public boolean isAllowedInFinalCode()
        Description copied from class: Type
        Returns true if this type is allowed to appear in final (clean) Jimple code.
        Overrides:
        isAllowedInFinalCode in class Type
        Returns: