public class AnalysisScope
extends java.lang.Object
The analysis scope is partitioned by class loader. There are three pre-defined class loader scopes:
rt.jar, the core classes)
Module.| Modifier and Type | Field and Description |
|---|---|
static Atom |
APPLICATION |
static Atom |
EXTENSION |
java.util.LinkedHashMap<Atom,ClassLoaderReference> |
loadersByName |
static Atom |
PRIMORDIAL |
static Atom |
SYNTHETIC |
| Modifier | Constructor and Description |
|---|---|
protected |
AnalysisScope(java.util.Collection<? extends Language> languages) |
| Modifier and Type | Method and Description |
|---|---|
void |
addClassFileToScope(ClassLoaderReference loader,
java.io.File file)
Add a class file to the scope for a loader
|
void |
addInputStreamForJarToScope(ClassLoaderReference loader,
java.io.InputStream stream)
Add a jar file to the scope via an
InputStream. |
void |
addSourceFileToScope(ClassLoaderReference loader,
java.io.File file,
java.lang.String fileName)
Add a class file to the scope for a loader
|
void |
addToScope(AnalysisScope other)
Add all modules from another scope
|
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
|
void |
addToScopeHead(ClassLoaderReference loader,
Module m)
Add a module file to the scope for a loader.
|
protected ClassLoaderReference |
classLoaderName2Ref(java.lang.String clName) |
static AnalysisScope |
createJavaAnalysisScope()
Create an analysis scope initialized for analysis of Java
|
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() |
java.util.Set<Language> |
getBaseLanguages() |
com.ibm.wala.util.config.SetOfClasses |
getExclusions() |
protected java.lang.Object |
getExclusionString() |
ClassLoaderReference |
getExtensionLoader()
Return the information regarding the extension loader.
|
java.lang.String |
getJavaLibraryVersion() |
Language |
getLanguage(Atom name) |
java.util.Collection<Language> |
getLanguages() |
ClassLoaderReference |
getLoader(Atom name) |
java.lang.String |
getLoaderImpl(ClassLoaderReference ref) |
java.util.Collection<ClassLoaderReference> |
getLoaders() |
java.util.List<Module> |
getModules(ClassLoaderReference loader) |
int |
getNumberOfLoaders() |
ClassLoaderReference |
getPrimordialLoader()
Return the information regarding the primordial loader.
|
ClassLoaderReference |
getSyntheticLoader()
Return the information regarding the application loader.
|
protected void |
initCoreForJava()
Initialize the standard 3 class loaders for java analysis
|
protected void |
initForJava()
Initialize a scope for java analysis
|
protected void |
initSynthetic(ClassLoaderReference parent)
Create the class loader for synthetic classes.
|
boolean |
isApplicationLoader(IClassLoader loader) |
boolean |
isJava14Libraries() |
boolean |
isJava15Libraries() |
boolean |
isJava16Libraries() |
boolean |
isJava17Libraries() |
boolean |
isJava18Libraries() |
void |
setExclusions(com.ibm.wala.util.config.SetOfClasses classes) |
void |
setLoaderImpl(ClassLoaderReference ref,
java.lang.String implClass) |
ShallowAnalysisScope |
toShallowAnalysisScope()
Creates a "serializable" version of the analysis scope.
|
java.lang.String |
toString() |
public static final Atom PRIMORDIAL
public static final Atom EXTENSION
public static final Atom APPLICATION
public static final Atom SYNTHETIC
public final java.util.LinkedHashMap<Atom,ClassLoaderReference> loadersByName
protected AnalysisScope(java.util.Collection<? extends Language> languages)
public static AnalysisScope createJavaAnalysisScope()
protected void initForJava()
protected void initCoreForJava()
protected void initSynthetic(ClassLoaderReference parent)
public boolean isApplicationLoader(IClassLoader loader)
public ClassLoaderReference getPrimordialLoader()
public ClassLoaderReference getExtensionLoader()
public ClassLoaderReference getApplicationLoader()
public ClassLoaderReference getSyntheticLoader()
public java.util.Collection<Language> getLanguages()
public java.util.Set<Language> getBaseLanguages()
public void addSourceFileToScope(ClassLoaderReference loader, java.io.File file, java.lang.String fileName) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic void addClassFileToScope(ClassLoaderReference loader, java.io.File file) throws java.lang.IllegalArgumentException, com.ibm.wala.shrikeCT.InvalidClassFileException
java.lang.IllegalArgumentExceptioncom.ibm.wala.shrikeCT.InvalidClassFileExceptionpublic void addInputStreamForJarToScope(ClassLoaderReference loader, java.io.InputStream stream) throws java.io.IOException
InputStream. NOTE: The InputStream should *not* be a
JarInputStream; it should be a regular InputStream for the raw
bytes of the jar file.java.io.IOExceptionpublic void addToScope(ClassLoaderReference loader, java.util.jar.JarFile file)
public void addToScope(ClassLoaderReference loader, Module m)
public void addToScope(AnalysisScope other)
public void addToScopeHead(ClassLoaderReference loader, Module m)
public ClassLoaderReference getLoader(Atom name) throws java.lang.IllegalArgumentException
name.java.lang.IllegalArgumentException - if name is nullprotected ClassLoaderReference classLoaderName2Ref(java.lang.String clName)
public java.lang.String getLoaderImpl(ClassLoaderReference ref)
public void setLoaderImpl(ClassLoaderReference ref, java.lang.String implClass)
public java.util.Collection<ClassLoaderReference> getLoaders()
public int getNumberOfLoaders()
public com.ibm.wala.util.config.SetOfClasses getExclusions()
public void setExclusions(com.ibm.wala.util.config.SetOfClasses classes)
public java.lang.String toString()
toString in class java.lang.Objectprotected java.lang.Object getExclusionString()
public MethodReference findMethod(Atom loader, java.lang.String klass, Atom name, ImmutableByteArray desc)
public java.util.List<Module> getModules(ClassLoaderReference loader)
public ArrayClassLoader getArrayClassLoader()
public java.lang.String getJavaLibraryVersion()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic boolean isJava18Libraries()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic boolean isJava17Libraries()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic boolean isJava16Libraries()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic boolean isJava15Libraries()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic boolean isJava14Libraries()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic ShallowAnalysisScope toShallowAnalysisScope() throws java.io.NotSerializableException
java.io.NotSerializableException