soot
Class Scene

java.lang.Object
  extended by soot.Scene

public class Scene
extends Object

Manages the SootClasses of the application being analyzed.


Field Summary
protected  LinkedList<String> excludedPackages
           
 
Constructor Summary
Scene(Singletons.Global g)
           
 
Method Summary
 void addBasicClass(String name)
           
 void addBasicClass(String name, int level)
           
 void addClass(SootClass c)
           
 void addRefType(RefType type)
          Returns the RefType with the given className.
 boolean allowsPhantomRefs()
           
 boolean containsClass(String className)
           
 boolean containsField(String fieldSignature)
           
 boolean containsMethod(String methodSignature)
           
 boolean containsType(String className)
           
 String defaultClassPath()
           
 boolean doneResolving()
           
 Collection<SootClass> dynamicClasses()
           
 SootClass forceResolve(String className, int level)
           
 Hierarchy getActiveHierarchy()
          Retrieves the active hierarchy
 Chain<SootClass> getApplicationClasses()
          Returns a chain of the application classes in this scene.
 Set<String> getBasicClasses()
           
 CallGraph getCallGraph()
           
 Chain<SootClass> getClasses()
          Returns an backed chain of the classes in this manager.
 List<SootClass> getClasses(int desiredLevel)
          Returns the list of SootClasses that have been resolved at least to the level specified.
 ArrayNumberer getClassNumberer()
           
 Numberer getContextNumberer()
           
 ContextSensitiveCallGraph getContextSensitiveCallGraph()
           
 ThrowAnalysis getDefaultThrowAnalysis()
          Returns the ThrowAnalysis to be used by default when constructing CFGs which include exceptional control flow.
 List<SootMethod> getEntryPoints()
          Get the set of entry points that are used to build the call graph.
 FastHierarchy getFastHierarchy()
          Retrieves the active fast hierarchy
 SootField getField(String fieldSignature)
           
 ArrayNumberer getFieldNumberer()
           
 Chain<SootClass> getLibraryClasses()
          Returns a chain of the library classes in this scene.
 ArrayNumberer getLocalNumberer()
           
 SootClass getMainClass()
           
 SootMethod getMainMethod()
           
 SootMethod getMethod(String methodSignature)
           
 ArrayNumberer getMethodNumberer()
           
 RefType getObjectType()
          Returns the RefType for Object.
 FastHierarchy getOrMakeFastHierarchy()
          Makes a new fast hierarchy is none is active, and returns the active fast hierarchy.
 Chain<SootClass> getPhantomClasses()
          Returns a chain of the phantom classes in this scene.
 boolean getPhantomRefs()
           
 ArrayList<String> getPkgList()
           
 PointsToAnalysis getPointsToAnalysis()
          Retrieves the active pointer analysis
 ReachableMethods getReachableMethods()
           
 RefType getRefType(String className)
          Returns the RefType with the given className.
 Set<String> getReservedNames()
          Returns a set of tokens which are reserved.
 SideEffectAnalysis getSideEffectAnalysis()
          Retrieves the active side-effect analysis
 SootClass getSootClass(String className)
          Returns the SootClass with the given className.
 String getSootClassPath()
           
 int getState()
           
 StringNumberer getSubSigNumberer()
           
 ArrayNumberer getTypeNumberer()
           
 Numberer getUnitNumberer()
           
 boolean hasActiveHierarchy()
           
 boolean hasCallGraph()
           
 boolean hasCustomEntryPoints()
           
 boolean hasFastHierarchy()
           
 boolean hasMainClass()
           
 boolean hasPointsToAnalysis()
           
 boolean hasReachableMethods()
           
 boolean hasSideEffectAnalysis()
           
 void incrementalBuildFinished()
           
 void initiateIncrementalBuild()
           
 boolean isExcluded(SootClass sc)
           
 boolean isIncrementalBuild()
          This method returns true when in incremental build mode.
 Numberer kindNumberer()
           
 void loadBasicClasses()
          Load just the set of basic classes soot needs, ignoring those specified on the command-line.
 SootClass loadClass(String className, int desiredLevel)
           
 SootClass loadClassAndSupport(String className)
          Loads the given class and all of the required support classes.
 void loadDynamicClasses()
           
 void loadNecessaryClasses()
          Load the set of classes that soot needs, including those specified on the command-line.
 SootMethodRef makeConstructorRef(SootClass declaringClass, List<Type> parameterTypes)
          Create an unresolved reference to a constructor.
 SootFieldRef makeFieldRef(SootClass declaringClass, String name, Type type, boolean isStatic)
          Create an unresolved reference to a field.
 SootMethodRef makeMethodRef(SootClass declaringClass, String name, List<Type> parameterTypes, Type returnType, boolean isStatic)
          Create an unresolved reference to a method.
 String quotedNameOf(String s)
          If this name is in the set of reserved names, then return a quoted version of it.
 void releaseActiveHierarchy()
           
 void releaseCallGraph()
           
 void releaseFastHierarchy()
           
 void releasePointsToAnalysis()
           
 void releaseReachableMethods()
           
 void releaseSideEffectAnalysis()
           
 void removeClass(SootClass c)
           
 void setActiveHierarchy(Hierarchy hierarchy)
          Sets the active hierarchy
 void setCallGraph(CallGraph cg)
           
 void setContextNumberer(Numberer n)
           
 void setContextSensitiveCallGraph(ContextSensitiveCallGraph cscg)
           
 void setDefaultThrowAnalysis(ThrowAnalysis ta)
          Sets the ThrowAnalysis to be used by default when constructing CFGs which include exceptional control flow.
 void setDoneResolving()
           
 void setEntryPoints(List<SootMethod> entryPoints)
          Change the set of entry point methods used to build the call graph.
 void setFastHierarchy(FastHierarchy hierarchy)
          Sets the active hierarchy
 void setMainClass(SootClass m)
           
 void setMainClassFromOptions()
           
 void setPhantomRefs(boolean value)
           
 void setPkgList(ArrayList<String> list)
           
 void setPointsToAnalysis(PointsToAnalysis pa)
          Sets the active pointer analysis
 void setReachableMethods(ReachableMethods rm)
           
 void setSideEffectAnalysis(SideEffectAnalysis sea)
          Sets the active side-effect analysis
 void setSootClassPath(String p)
           
 String signatureToClass(String sig)
           
 String signatureToSubsignature(String sig)
           
 SootClass tryLoadClass(String className, int desiredLevel)
          Attempts to load the given class and all of the required support classes.
static Scene v()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

excludedPackages

protected LinkedList<String> excludedPackages
Constructor Detail

Scene

public Scene(Singletons.Global g)
Method Detail

v

public static Scene v()

setMainClass

public void setMainClass(SootClass m)

getReservedNames

public Set<String> getReservedNames()
Returns a set of tokens which are reserved. Any field, class, method, or local variable with such a name will be quoted.


quotedNameOf

public String quotedNameOf(String s)
If this name is in the set of reserved names, then return a quoted version of it. Else pass it through.


hasMainClass

public boolean hasMainClass()

getMainClass

public SootClass getMainClass()

getMainMethod

public SootMethod getMainMethod()

setSootClassPath

public void setSootClassPath(String p)

getSootClassPath

public String getSootClassPath()

defaultClassPath

public String defaultClassPath()

getState

public int getState()

addClass

public void addClass(SootClass c)

removeClass

public void removeClass(SootClass c)

containsClass

public boolean containsClass(String className)

containsType

public boolean containsType(String className)

signatureToClass

public String signatureToClass(String sig)

signatureToSubsignature

public String signatureToSubsignature(String sig)

containsField

public boolean containsField(String fieldSignature)

containsMethod

public boolean containsMethod(String methodSignature)

getField

public SootField getField(String fieldSignature)

getMethod

public SootMethod getMethod(String methodSignature)

tryLoadClass

public SootClass tryLoadClass(String className,
                              int desiredLevel)
Attempts to load the given class and all of the required support classes. Returns the original class if it was loaded, or null otherwise.


loadClassAndSupport

public SootClass loadClassAndSupport(String className)
Loads the given class and all of the required support classes. Returns the first class.


loadClass

public SootClass loadClass(String className,
                           int desiredLevel)

getRefType

public RefType getRefType(String className)
Returns the RefType with the given className.

Throws:
IllegalStateException - if the RefType for this class cannot be found. Use containsType(String) to check if type is registered

getObjectType

public RefType getObjectType()
Returns the RefType for Object.


addRefType

public void addRefType(RefType type)
Returns the RefType with the given className.


getSootClass

public SootClass getSootClass(String className)
Returns the SootClass with the given className.


getClasses

public Chain<SootClass> getClasses()
Returns an backed chain of the classes in this manager.


getApplicationClasses

public Chain<SootClass> getApplicationClasses()
Returns a chain of the application classes in this scene. These classes are the ones which can be freely analysed & modified.


getLibraryClasses

public Chain<SootClass> getLibraryClasses()
Returns a chain of the library classes in this scene. These classes can be analysed but not modified.


getPhantomClasses

public Chain<SootClass> getPhantomClasses()
Returns a chain of the phantom classes in this scene. These classes are referred to by other classes, but cannot be loaded.


getSideEffectAnalysis

public SideEffectAnalysis getSideEffectAnalysis()
Retrieves the active side-effect analysis


setSideEffectAnalysis

public void setSideEffectAnalysis(SideEffectAnalysis sea)
Sets the active side-effect analysis


hasSideEffectAnalysis

public boolean hasSideEffectAnalysis()

releaseSideEffectAnalysis

public void releaseSideEffectAnalysis()

getPointsToAnalysis

public PointsToAnalysis getPointsToAnalysis()
Retrieves the active pointer analysis


setPointsToAnalysis

public void setPointsToAnalysis(PointsToAnalysis pa)
Sets the active pointer analysis


hasPointsToAnalysis

public boolean hasPointsToAnalysis()

releasePointsToAnalysis

public void releasePointsToAnalysis()

getOrMakeFastHierarchy

public FastHierarchy getOrMakeFastHierarchy()
Makes a new fast hierarchy is none is active, and returns the active fast hierarchy.


getFastHierarchy

public FastHierarchy getFastHierarchy()
Retrieves the active fast hierarchy


setFastHierarchy

public void setFastHierarchy(FastHierarchy hierarchy)
Sets the active hierarchy


hasFastHierarchy

public boolean hasFastHierarchy()

releaseFastHierarchy

public void releaseFastHierarchy()

getActiveHierarchy

public Hierarchy getActiveHierarchy()
Retrieves the active hierarchy


setActiveHierarchy

public void setActiveHierarchy(Hierarchy hierarchy)
Sets the active hierarchy


hasActiveHierarchy

public boolean hasActiveHierarchy()

releaseActiveHierarchy

public void releaseActiveHierarchy()

hasCustomEntryPoints

public boolean hasCustomEntryPoints()

getEntryPoints

public List<SootMethod> getEntryPoints()
Get the set of entry points that are used to build the call graph.


setEntryPoints

public void setEntryPoints(List<SootMethod> entryPoints)
Change the set of entry point methods used to build the call graph.


getContextSensitiveCallGraph

public ContextSensitiveCallGraph getContextSensitiveCallGraph()

setContextSensitiveCallGraph

public void setContextSensitiveCallGraph(ContextSensitiveCallGraph cscg)

getCallGraph

public CallGraph getCallGraph()

setCallGraph

public void setCallGraph(CallGraph cg)

hasCallGraph

public boolean hasCallGraph()

releaseCallGraph

public void releaseCallGraph()

getReachableMethods

public ReachableMethods getReachableMethods()

setReachableMethods

public void setReachableMethods(ReachableMethods rm)

hasReachableMethods

public boolean hasReachableMethods()

releaseReachableMethods

public void releaseReachableMethods()

getPhantomRefs

public boolean getPhantomRefs()

setPhantomRefs

public void setPhantomRefs(boolean value)

allowsPhantomRefs

public boolean allowsPhantomRefs()

kindNumberer

public Numberer kindNumberer()

getTypeNumberer

public ArrayNumberer getTypeNumberer()

getMethodNumberer

public ArrayNumberer getMethodNumberer()

getContextNumberer

public Numberer getContextNumberer()

getUnitNumberer

public Numberer getUnitNumberer()

getFieldNumberer

public ArrayNumberer getFieldNumberer()

getClassNumberer

public ArrayNumberer getClassNumberer()

getSubSigNumberer

public StringNumberer getSubSigNumberer()

getLocalNumberer

public ArrayNumberer getLocalNumberer()

setContextNumberer

public void setContextNumberer(Numberer n)

getDefaultThrowAnalysis

public ThrowAnalysis getDefaultThrowAnalysis()
Returns the ThrowAnalysis to be used by default when constructing CFGs which include exceptional control flow.

Returns:
the default ThrowAnalysis

setDefaultThrowAnalysis

public void setDefaultThrowAnalysis(ThrowAnalysis ta)
Sets the ThrowAnalysis to be used by default when constructing CFGs which include exceptional control flow.

Parameters:
the - default ThrowAnalysis.

addBasicClass

public void addBasicClass(String name)

addBasicClass

public void addBasicClass(String name,
                          int level)

loadBasicClasses

public void loadBasicClasses()
Load just the set of basic classes soot needs, ignoring those specified on the command-line. You don't need to use both this and loadNecessaryClasses, though it will only waste time.


getBasicClasses

public Set<String> getBasicClasses()

dynamicClasses

public Collection<SootClass> dynamicClasses()

loadNecessaryClasses

public void loadNecessaryClasses()
Load the set of classes that soot needs, including those specified on the command-line. This is the standard way of initialising the list of classes soot should use.


loadDynamicClasses

public void loadDynamicClasses()

isExcluded

public boolean isExcluded(SootClass sc)

setPkgList

public void setPkgList(ArrayList<String> list)

getPkgList

public ArrayList<String> getPkgList()

makeMethodRef

public SootMethodRef makeMethodRef(SootClass declaringClass,
                                   String name,
                                   List<Type> parameterTypes,
                                   Type returnType,
                                   boolean isStatic)
Create an unresolved reference to a method.


makeConstructorRef

public SootMethodRef makeConstructorRef(SootClass declaringClass,
                                        List<Type> parameterTypes)
Create an unresolved reference to a constructor.


makeFieldRef

public SootFieldRef makeFieldRef(SootClass declaringClass,
                                 String name,
                                 Type type,
                                 boolean isStatic)
Create an unresolved reference to a field.


getClasses

public List<SootClass> getClasses(int desiredLevel)
Returns the list of SootClasses that have been resolved at least to the level specified.


doneResolving

public boolean doneResolving()

setDoneResolving

public void setDoneResolving()

setMainClassFromOptions

public void setMainClassFromOptions()

isIncrementalBuild

public boolean isIncrementalBuild()
This method returns true when in incremental build mode. Other classes can query this flag and change the way in which they use the Scene, depending on the flag's value.


initiateIncrementalBuild

public void initiateIncrementalBuild()

incrementalBuildFinished

public void incrementalBuildFinished()

forceResolve

public SootClass forceResolve(String className,
                              int level)