Package soot
Class ArrayType
- java.lang.Object
-
- soot.Type
-
- soot.RefLikeType
-
- soot.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 Summary
Fields Modifier and Type Field Description TypebaseTypebaseType 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.intnumDimensionsdimension count for the array type
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(Switch sw)Method required for use of Switchable.booleanequals(Object t)Two ArrayType are 'equal' if they are parameterized identically.TypegetArrayElementType()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.TypegetElementType()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.inthashCode()booleanisAllowedInFinalCode()Returnstrueif this type is allowed to appear in final (clean) Jimple code.ArrayTypemakeArrayType()StringtoQuotedString()Returns a textual representation, quoted as needed, of this type for serialization, e.g.StringtoString()Returns a textual representation of this type.voidtoString(UnitPrinter up)static ArrayTypev(Type baseType, int numDimensions)Creates an ArrayType parameterized by a given Type and dimension count.-
Methods inherited from class soot.Type
getArrayType, getDefaultFinalType, getEscapedName, getNumber, merge, setArrayType, setNumber, toMachineType
-
-
-
-
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 ArrayTypenumDimensions- 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.
-
toString
public void toString(UnitPrinter up)
-
toString
public String toString()
Description copied from class:TypeReturns a textual representation of this type.
-
toQuotedString
public String toQuotedString()
Returns a textual representation, quoted as needed, of this type for serialization, e.g. to .jimple format- Overrides:
toQuotedStringin classType
-
apply
public void apply(Switch sw)
Description copied from class:TypeMethod required for use of Switchable.- Specified by:
applyin interfaceSwitchable- Overrides:
applyin classType
-
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:
getArrayElementTypein classRefLikeType
-
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.
-
makeArrayType
public ArrayType makeArrayType()
- Overrides:
makeArrayTypein classType
-
isAllowedInFinalCode
public boolean isAllowedInFinalCode()
Description copied from class:TypeReturnstrueif this type is allowed to appear in final (clean) Jimple code.- Overrides:
isAllowedInFinalCodein classType- Returns:
-
-