Skip to content

Commit cd28a39

Browse files
jerryxu158msridhar
andauthored
AnalysisScope example (#11)
* initial commit * initial commit * JavaDoc creation & removal of static keyword on import * hopefully finished the scope file example implementation * fixed scope file input * changed param names, renamed class * changed exception to exlcusion * tweaks --------- Co-authored-by: Manu Sridharan <[email protected]>
1 parent fd1dbc4 commit cd28a39

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.ibm.wala.examples.analysisscope;
2+
3+
import com.ibm.wala.core.util.config.AnalysisScopeReader;
4+
import com.ibm.wala.ipa.callgraph.AnalysisScope;
5+
import java.io.File;
6+
import java.io.IOException;
7+
8+
/**
9+
* This class shows two ways to create an {@link AnalysisScope}. for more information, check out
10+
* https://github.com/wala/WALA/wiki/Analysis-Scope
11+
*/
12+
public class AnalysisScopeExample {
13+
/**
14+
* @param classPath paths of jars to include in analysis scope, formatted as a Java classpath
15+
* @return AnaylsisScope object created by makeJavaBinaryAnalysisScope
16+
* @throws IOException
17+
*/
18+
AnalysisScope makeAnalysisScope(String classPath) throws IOException {
19+
return AnalysisScopeReader.instance.makeJavaBinaryAnalysisScope(classPath, null);
20+
}
21+
22+
/**
23+
* @param scopeFilePath Location of a scope file in string form
24+
* @param exclusionFilePath location of an exception file
25+
* @return return an analysis scope object
26+
* @throws IOException
27+
*/
28+
AnalysisScope makeAnalysisScope(String scopeFilePath, String exclusionFilePath)
29+
throws IOException {
30+
File exclusionsFile = new File(exclusionFilePath);
31+
return AnalysisScopeReader.instance.readJavaScope(
32+
scopeFilePath, exclusionsFile, AnalysisScopeExample.class.getClassLoader());
33+
}
34+
}

0 commit comments

Comments
 (0)