-
Notifications
You must be signed in to change notification settings - Fork 221
Analysis Scope
An AnalysisScope
specifies the application and library code to be
analyzed.
AnalysisScopeReader.makeJavaBinaryAnalysisScope()
constructs an AnalysisScope
given a Java classpath String and an
exclusions file (discussed further below). For more control, use the
AnalysisScopeReader.readJavaScope()
method, whose first parameter is the name of a text scope file
specifying the analysis scope. A scope file has lines of the following
format:
Classloader,Language,Type,Location
For Java, Classloader is one of Primordial
, Extension
, or
Application
(see Naming Java Entities). Primordial
is
reserved for the Java standard libraries. If you want to use the same standard
library as the JVM WALA is running on for analysis, the following two
lines for Primordial
should do the right thing:
Primordial,Java,stdlib,none
Primordial,Java,jarFile,primordial.jar.model
If you would like to analyze some other version of the Java standard library, remove the
Primordial,Java,stdlib,none
line, and instead add lines of the form
Primordial,Java,stdlib,/path/to/lib.jar
for each standard library jar file
you would like to analyze (e.g., an rt.jar
file). Retain the Primordial,Java,jarFile,primordial.jar.model
line so that appropriate library models are used.
Extension
entries should be used for other libraries used by the
application, while Application
entries should be used for the
application code itself. Some valid values of Type are:
-
classFile
for a single.class
file -
binaryDir
for a directory containing class files (with the standard package-to-sub-directory correspondence) -
jarFile
for a.jar
file -
sourceFile
andsourceDir
for source files. This is for use with a Java source front end, or to provide source file locations for class files in the scope. For the latter use case, make sure the class files / directories appear in the scope file before the correspondingsourceFile
orsourceDir
.
Location should give the appropriate filesystem path. Here's a full example:
Primordial,Java,stdlib,none
Primordial,Java,jarFile,primordial.jar.model
Extension,Java,jarFile,/workspace/myapp/lib/someLib.jar
Application,Java,binaryDir,/workspace/myApp/bin
An exclusions file is a text file giving patterns of class names that should be excluded from an AnalysisScope
.
Using an exclusions file can help with the scalability of analyses like call graph construction, in the case where
certain classes are present but known to be irrelevant (or likely irrelevant) to the analysis. Note that excluding
relevant classes could be a source of analysis unsoundness.
Each line in an exclusions file excludes classes in a package or set of packages, e.g.:
java\/awt\/.*
javax\/swing\/.*
sun\/awt\/.*
A full example is here.