com.ibm.wala.ipa.callgraph
Class AnalysisScope

java.lang.Object
  extended by com.ibm.wala.ipa.callgraph.AnalysisScope
Direct Known Subclasses:
CAstAnalysisScope, EclipseAnalysisScope, EMFScopeWrapper, JavaSourceAnalysisScope

public class AnalysisScope
extends java.lang.Object

Base class that represents a set of files to analyze. The analysis scope is partitioned by class loader. There are three pre-defined class loader scopes:


Field Summary
static Atom APPLICATION
           
static Atom EXTENSION
           
protected  java.util.LinkedHashMap<Atom,ClassLoaderReference> loadersByName
          map: Atom -> ClassLoaderReference
static Atom PRIMORDIAL
           
static Atom SYNTHETIC
           
 
Constructor Summary
AnalysisScope()
           
 
Method Summary
 void addClassFileToScope(ClassLoaderReference loader, java.io.File file)
          Add a class file to the scope for a loader
 void addSourceFileToScope(ClassLoaderReference loader, java.io.File file, java.lang.String fileName)
          Add a class file to the scope for a loader
 void addToScope(ClassLoaderReference loader, java.util.jar.JarFile file)
          Add a jar file to the scope for a loader
 void addToScope(ClassLoaderReference loader, Module m)
          Add a module to the scope for a loader
protected  ClassLoaderReference classLoaderName2Ref(java.lang.String clName)
          Method classLoaderName2Ref.
 MethodReference findMethod(Atom loader, java.lang.String klass, Atom name, ImmutableByteArray desc)
          Utility function.
 ClassLoaderReference getApplicationLoader()
          Return the information regarding the application loader.
 ArrayClassLoader getArrayClassLoader()
           
 SetOfClasses getExclusions()
           
protected  java.lang.Object getExclusionString()
           
 ClassLoaderReference getExtensionLoader()
          Return the information regarding the extension loader.
 java.lang.String getJavaLibraryVersion()
           
 ClassLoaderReference getLoader(Atom name)
           
 java.lang.String getLoaderImpl(ClassLoaderReference ref)
           
 java.util.Collection<ClassLoaderReference> getLoaders()
           
 java.util.Set<Module> getModules(ClassLoaderReference loader)
           
 int getNumberOfLoaders()
           
 ClassLoaderReference getPrimordialLoader()
          Return the information regarding the primordial loader.
 ClassLoaderReference getSyntheticLoader()
          Return the information regarding the application loader.
 boolean isJava14Libraries()
           
 boolean isJava15Libraries()
           
 void setExclusions(SetOfClasses classes)
           
protected  void setLoaderImpl(ClassLoaderReference ref, java.lang.String implClass)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PRIMORDIAL

public static final Atom PRIMORDIAL

EXTENSION

public static final Atom EXTENSION

APPLICATION

public static final Atom APPLICATION

SYNTHETIC

public static final Atom SYNTHETIC

loadersByName

protected final java.util.LinkedHashMap<Atom,ClassLoaderReference> loadersByName
map: Atom -> ClassLoaderReference

Constructor Detail

AnalysisScope

public AnalysisScope()
Method Detail

getPrimordialLoader

public ClassLoaderReference getPrimordialLoader()
Return the information regarding the primordial loader.

Returns:
ClassLoaderReference

getExtensionLoader

public ClassLoaderReference getExtensionLoader()
Return the information regarding the extension loader.

Returns:
ClassLoaderReference

getApplicationLoader

public ClassLoaderReference getApplicationLoader()
Return the information regarding the application loader.

Returns:
ClassLoaderReference

getSyntheticLoader

public ClassLoaderReference getSyntheticLoader()
Return the information regarding the application loader.

Returns:
ClassLoaderReference

addSourceFileToScope

public void addSourceFileToScope(ClassLoaderReference loader,
                                 java.io.File file,
                                 java.lang.String fileName)
                          throws java.lang.IllegalArgumentException
Add a class file to the scope for a loader

Parameters:
loader -
file -
Throws:
java.lang.IllegalArgumentException

addClassFileToScope

public void addClassFileToScope(ClassLoaderReference loader,
                                java.io.File file)
                         throws java.lang.IllegalArgumentException
Add a class file to the scope for a loader

Parameters:
loader -
file -
Throws:
java.lang.IllegalArgumentException

addToScope

public void addToScope(ClassLoaderReference loader,
                       java.util.jar.JarFile file)
Add a jar file to the scope for a loader

Parameters:
loader -
file -

addToScope

public void addToScope(ClassLoaderReference loader,
                       Module m)
Add a module to the scope for a loader

Parameters:
loader -
m -

getLoader

public ClassLoaderReference getLoader(Atom name)
                               throws java.lang.IllegalArgumentException
Returns:
the ClassLoaderReference specified by name.
Throws:
java.lang.IllegalArgumentException - if name is null

classLoaderName2Ref

protected ClassLoaderReference classLoaderName2Ref(java.lang.String clName)
Method classLoaderName2Ref.

Parameters:
clName -
Returns:
ClassLoaderReference

getLoaderImpl

public java.lang.String getLoaderImpl(ClassLoaderReference ref)

setLoaderImpl

protected void setLoaderImpl(ClassLoaderReference ref,
                             java.lang.String implClass)

getLoaders

public java.util.Collection<ClassLoaderReference> getLoaders()
Returns:
an Iterator over the loaders.

getNumberOfLoaders

public int getNumberOfLoaders()
Returns:
the number of loaders.

getExclusions

public SetOfClasses getExclusions()

setExclusions

public void setExclusions(SetOfClasses classes)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getExclusionString

protected java.lang.Object getExclusionString()
Returns:
a String that describes exclusions from the analysis scope.

findMethod

public MethodReference findMethod(Atom loader,
                                  java.lang.String klass,
                                  Atom name,
                                  ImmutableByteArray desc)
Utility function. Useful when parsing input.


getModules

public java.util.Set<Module> getModules(ClassLoaderReference loader)

getArrayClassLoader

public ArrayClassLoader getArrayClassLoader()
Returns:
Returns the arrayClassLoader.

getJavaLibraryVersion

public java.lang.String getJavaLibraryVersion()
                                       throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

isJava15Libraries

public boolean isJava15Libraries()
                          throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

isJava14Libraries

public boolean isJava14Libraries()
                          throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException