soot
Class RefType

java.lang.Object
  extended by soot.Type
      extended by soot.RefLikeType
          extended by soot.RefType
All Implemented Interfaces:
Serializable, Comparable, Numberable, Switchable

public class RefType
extends RefLikeType
implements Comparable

A class that models Java's reference types. RefTypes are parametrized by a class name. Two RefType are equal iff they are parametrized by the same class name as a String.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class soot.Type
arrayType
 
Constructor Summary
RefType(Singletons.Global g)
           
 
Method Summary
 void apply(Switch sw)
          Method required for use of Switchable.
 int compareTo(Object o)
           
 boolean equals(Object t)
          2 RefTypes are considered equal if they are parametrized by the same class name String.
 AnySubType getAnySubType()
           
 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 even later to answer this question for all classes implementing RefLikeType.
 String getClassName()
           
 SootClass getSootClass()
          Get the SootClass object corresponding to this RefType.
 int hashCode()
           
 boolean hasSootClass()
           
 Type merge(Type other, Scene cm)
          Returns the least common superclass of this type and other.
 void setAnySubType(AnySubType anySubType)
           
 void setClassName(String className)
           
 void setSootClass(SootClass sootClass)
          Set the SootClass object corresponding to this RefType.
 String toString()
          Returns a textual representation of this type.
static RefType v()
           
static RefType v(SootClass c)
          Create a RefType for a class.
static RefType v(String className)
          Create a RefType for a class.
 
Methods inherited from class soot.Type
getArrayType, getNumber, makeArrayType, setArrayType, setNumber, toMachineType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RefType

public RefType(Singletons.Global g)
Method Detail

v

public static RefType v()

getClassName

public String getClassName()

v

public static RefType v(String className)
Create a RefType for a class.

Parameters:
className - The name of the class used to parametrize the created RefType.
Returns:
a RefType for the given class name.

compareTo

public int compareTo(Object o)
              throws ClassCastException
Specified by:
compareTo in interface Comparable
Throws:
ClassCastException

v

public static RefType v(SootClass c)
Create a RefType for a class.

Parameters:
c - A SootClass for which to create a RefType.
Returns:
a RefType for the given SootClass..

getSootClass

public SootClass getSootClass()
Get the SootClass object corresponding to this RefType.

Returns:
the corresponding SootClass

hasSootClass

public boolean hasSootClass()

setClassName

public void setClassName(String className)

setSootClass

public void setSootClass(SootClass sootClass)
Set the SootClass object corresponding to this RefType.

Parameters:
sootClass - The SootClass corresponding to this RefType.

equals

public boolean equals(Object t)
2 RefTypes are considered equal if they are parametrized by the same class name String.

Overrides:
equals in class Object
Parameters:
t - an object to test for equality.

toString

public String toString()
Description copied from class: Type
Returns a textual representation of this type.

Specified by:
toString 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

merge

public Type merge(Type other,
                  Scene cm)
Returns the least common superclass of this type and other.

Overrides:
merge in class Type

getArrayElementType

public Type getArrayElementType()
Description copied from class: RefLikeType
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 even later 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

getAnySubType

public AnySubType getAnySubType()

setAnySubType

public void setAnySubType(AnySubType anySubType)