Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnalysisScope example #11

Merged
merged 9 commits into from
Nov 30, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.ibm.wala.examples.analysisscope;

import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.util.config.FileOfClasses;
import com.ibm.wala.util.config.AnalysisScopeReader;

import java.io.File;
import java.io.IOException;
import com.ibm.wala.util.config.AnalysisScopeReader;

/**
* This file is an example of 2 ways to create an analysis scope.
* for more information on analysis scopes, please 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.makeJavaBinaryAnalysisScope(classPath, null);
}

/**
*
* @param scopeFilePath Location of a scope file in string form
* @param exceptionFilePath location of an exception file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everywhere you write exception it should be exclusion. These files give a pattern of which Java packages to exclude from the scope

* @return return an analysis scope object
* @throws IOException
*/
AnalysisScope makeAnalysisScope(String scopeFilePath, String exceptionFilePath) throws IOException{
File exception = new File(exceptionFilePath);
return AnalysisScopeReader.readJavaScope(scopeFilePath, exception, AnalysisScopeExample.class.getClassLoader());
}
}