Skip to content

Commit

Permalink
AnalysisScope example (#11)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
jerryxu158 and msridhar authored Nov 30, 2024
1 parent fd1dbc4 commit cd28a39
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.ibm.wala.examples.analysisscope;

import com.ibm.wala.core.util.config.AnalysisScopeReader;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import java.io.File;
import java.io.IOException;

/**
* This class shows two ways to create an {@link AnalysisScope}. for more information, check out
* https://github.com/wala/WALA/wiki/Analysis-Scope
*/
public class AnalysisScopeExample {
/**
* @param classPath paths of jars to include in analysis scope, formatted as a Java classpath
* @return AnaylsisScope object created by makeJavaBinaryAnalysisScope
* @throws IOException
*/
AnalysisScope makeAnalysisScope(String classPath) throws IOException {
return AnalysisScopeReader.instance.makeJavaBinaryAnalysisScope(classPath, null);
}

/**
* @param scopeFilePath Location of a scope file in string form
* @param exclusionFilePath location of an exception file
* @return return an analysis scope object
* @throws IOException
*/
AnalysisScope makeAnalysisScope(String scopeFilePath, String exclusionFilePath)
throws IOException {
File exclusionsFile = new File(exclusionFilePath);
return AnalysisScopeReader.instance.readJavaScope(
scopeFilePath, exclusionsFile, AnalysisScopeExample.class.getClassLoader());
}
}

0 comments on commit cd28a39

Please sign in to comment.