From eecf3608f35292469ebd77a22eff09f100c630e7 Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 11 Oct 2021 23:48:06 -0700 Subject: [PATCH 1/8] initial commit --- .../examples/AnalysisScopeExamples/AnalysisScopeExamples.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java diff --git a/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java b/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java new file mode 100644 index 0000000..c973db1 --- /dev/null +++ b/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java @@ -0,0 +1,4 @@ +package com.ibm.wala.examples.AnalysisScopeExamples; + +public class AnalysisScopeExamples { +} From 269c7f33e32b1a554dfc27f47f80d9147a86b62e Mon Sep 17 00:00:00 2001 From: Jerry Date: Fri, 15 Oct 2021 17:17:12 -0700 Subject: [PATCH 2/8] initial commit --- .../AnalysisScopeExamples/AnalysisScopeExamples.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java b/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java index c973db1..0daa637 100644 --- a/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java +++ b/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java @@ -1,4 +1,16 @@ package com.ibm.wala.examples.AnalysisScopeExamples; +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.IOException; + +import static com.ibm.wala.util.config.AnalysisScopeReader.makeJavaBinaryAnalysisScope; + public class AnalysisScopeExamples { + AnalysisScope makeAnalysisScope(String classPath) throws IOException{ + return makeJavaBinaryAnalysisScope(classPath, null); + } } From e49b1da4b65e230838d173ae509b7c5097a2faa9 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sat, 23 Oct 2021 15:22:49 -0700 Subject: [PATCH 3/8] JavaDoc creation & removal of static keyword on import --- .../AnalysisScopeExamples/AnalysisScopeExamples.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java b/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java index 0daa637..d06e63f 100644 --- a/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java +++ b/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java @@ -7,10 +7,15 @@ import java.io.IOException; -import static com.ibm.wala.util.config.AnalysisScopeReader.makeJavaBinaryAnalysisScope; +import com.ibm.wala.util.config.AnalysisScopeReader; public class AnalysisScopeExamples { + /** + * @param classPath takes in location of a class file through a string format rather than a JSON file + * @return AnaylsisScope object created by makeJavaBinaryAnalysisScope + * @throws IOException + */ AnalysisScope makeAnalysisScope(String classPath) throws IOException{ - return makeJavaBinaryAnalysisScope(classPath, null); + return AnalysisScopeReader.makeJavaBinaryAnalysisScope(classPath, null); } } From 9626f973825b67695c8d4801917656c62ad11419 Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 25 Oct 2021 14:23:35 -0700 Subject: [PATCH 4/8] hopefully finished the scope file example implementation --- .../AnalysisScopeExamples.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java b/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java index d06e63f..0a99652 100644 --- a/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java +++ b/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java @@ -5,17 +5,31 @@ 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; +//for more information, please check out https://github.com/wala/WALA/wiki/Analysis-Scope + + public class AnalysisScopeExamples { /** * @param classPath takes in location of a class file through a string format rather than a JSON file * @return AnaylsisScope object created by makeJavaBinaryAnalysisScope * @throws IOException */ - AnalysisScope makeAnalysisScope(String classPath) throws IOException{ - return AnalysisScopeReader.makeJavaBinaryAnalysisScope(classPath, null); + AnalysisScope makeAnalysisScope(String classPath) throws IOException { + return AnalysisScopeReader.makeJavaBinaryAnalysisScope(classPath, null); + } + + /** + * + * @param classPath Location of a scope file in string form + * @param exceptionFile location of an exception file + * @return return an analysis scope object + * @throws IOException + */ + AnalysisScope makeAnalysisScope(String classPath, String exceptionFile) throws IOException{ + return AnalysisScopeReader.makeJavaBinaryAnalysisScope(classPath, new File(exceptionFile)); } } From 4c2c8b4bbf79ab855112a1087d10d7d998f60142 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sat, 30 Oct 2021 15:02:55 -0700 Subject: [PATCH 5/8] fixed scope file input --- .../analysisscope.java} | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename src/main/java/com/ibm/wala/examples/{AnalysisScopeExamples/AnalysisScopeExamples.java => analysisscope/analysisscope.java} (76%) diff --git a/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java b/src/main/java/com/ibm/wala/examples/analysisscope/analysisscope.java similarity index 76% rename from src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java rename to src/main/java/com/ibm/wala/examples/analysisscope/analysisscope.java index 0a99652..d85b640 100644 --- a/src/main/java/com/ibm/wala/examples/AnalysisScopeExamples/AnalysisScopeExamples.java +++ b/src/main/java/com/ibm/wala/examples/analysisscope/analysisscope.java @@ -1,4 +1,4 @@ -package com.ibm.wala.examples.AnalysisScopeExamples; +package com.ibm.wala.examples.analysisscope; import com.ibm.wala.ipa.callgraph.AnalysisScope; import com.ibm.wala.ipa.callgraph.AnalysisScope; @@ -12,9 +12,9 @@ //for more information, please check out https://github.com/wala/WALA/wiki/Analysis-Scope -public class AnalysisScopeExamples { +public class analysisscope { /** - * @param classPath takes in location of a class file through a string format rather than a JSON file + * @param classPath paths of jars to include in analysis scope, formatted as a Java classpath * @return AnaylsisScope object created by makeJavaBinaryAnalysisScope * @throws IOException */ @@ -30,6 +30,7 @@ AnalysisScope makeAnalysisScope(String classPath) throws IOException { * @throws IOException */ AnalysisScope makeAnalysisScope(String classPath, String exceptionFile) throws IOException{ - return AnalysisScopeReader.makeJavaBinaryAnalysisScope(classPath, new File(exceptionFile)); + File exception = new File(exceptionFile); + return AnalysisScopeReader.readJavaScope(classPath, exception, null); } } From 62d2d6d02dfce243c52a0b08b98a2fead179a0ad Mon Sep 17 00:00:00 2001 From: Jerry Date: Fri, 5 Nov 2021 15:16:27 -0700 Subject: [PATCH 6/8] changed param names, renamed class --- ...sisscope.java => AnalysisScopeExample.java} | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) rename src/main/java/com/ibm/wala/examples/analysisscope/{analysisscope.java => AnalysisScopeExample.java} (56%) diff --git a/src/main/java/com/ibm/wala/examples/analysisscope/analysisscope.java b/src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java similarity index 56% rename from src/main/java/com/ibm/wala/examples/analysisscope/analysisscope.java rename to src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java index d85b640..7b5b234 100644 --- a/src/main/java/com/ibm/wala/examples/analysisscope/analysisscope.java +++ b/src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java @@ -9,10 +9,14 @@ import java.io.IOException; import com.ibm.wala.util.config.AnalysisScopeReader; -//for more information, please check out https://github.com/wala/WALA/wiki/Analysis-Scope +/** + * 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 analysisscope { +public class AnalysisScopeExample { /** * @param classPath paths of jars to include in analysis scope, formatted as a Java classpath * @return AnaylsisScope object created by makeJavaBinaryAnalysisScope @@ -24,13 +28,13 @@ AnalysisScope makeAnalysisScope(String classPath) throws IOException { /** * - * @param classPath Location of a scope file in string form - * @param exceptionFile location of an exception file + * @param scopeFilePath Location of a scope file in string form + * @param exceptionFilePath location of an exception file * @return return an analysis scope object * @throws IOException */ - AnalysisScope makeAnalysisScope(String classPath, String exceptionFile) throws IOException{ - File exception = new File(exceptionFile); - return AnalysisScopeReader.readJavaScope(classPath, exception, null); + AnalysisScope makeAnalysisScope(String scopeFilePath, String exceptionFilePath) throws IOException{ + File exception = new File(exceptionFilePath); + return AnalysisScopeReader.readJavaScope(scopeFilePath, exception, AnalysisScopeExample.class.getClassLoader()); } } From f8dbf0dff457ef6aa25baca6534743e205ffdb93 Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 17 Jan 2022 16:08:19 -0800 Subject: [PATCH 7/8] changed exception to exlcusion --- .../wala/examples/analysisscope/AnalysisScopeExample.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java b/src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java index 7b5b234..d87d525 100644 --- a/src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java +++ b/src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java @@ -29,12 +29,12 @@ AnalysisScope makeAnalysisScope(String classPath) throws IOException { /** * * @param scopeFilePath Location of a scope file in string form - * @param exceptionFilePath location of an exception file + * @param exclusionFilePath location of an exception file * @return return an analysis scope object * @throws IOException */ - AnalysisScope makeAnalysisScope(String scopeFilePath, String exceptionFilePath) throws IOException{ - File exception = new File(exceptionFilePath); + AnalysisScope makeAnalysisScope(String scopeFilePath, String exclusionFilePath) throws IOException{ + File exception = new File(exclusionFilePath); return AnalysisScopeReader.readJavaScope(scopeFilePath, exception, AnalysisScopeExample.class.getClassLoader()); } } From 66cf8de41f76b62ef33da7d4bf1b69bb4f0cf5ec Mon Sep 17 00:00:00 2001 From: Manu Sridharan Date: Sat, 30 Nov 2024 10:33:45 -0800 Subject: [PATCH 8/8] tweaks --- .../analysisscope/AnalysisScopeExample.java | 52 ++++++++----------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java b/src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java index d87d525..d4ffa07 100644 --- a/src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java +++ b/src/main/java/com/ibm/wala/examples/analysisscope/AnalysisScopeExample.java @@ -1,40 +1,34 @@ package com.ibm.wala.examples.analysisscope; +import com.ibm.wala.core.util.config.AnalysisScopeReader; 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 - * + * 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.makeJavaBinaryAnalysisScope(classPath, null); - } + /** + * @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 exception = new File(exclusionFilePath); - return AnalysisScopeReader.readJavaScope(scopeFilePath, exception, AnalysisScopeExample.class.getClassLoader()); - } + /** + * @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()); + } }