clean up and refactor some APIs surrounding file I/O and exclusions files. Needed in order to allow clients to use some APIs with application-specific exclusions.

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2248 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2008-01-02 22:27:45 +00:00
parent fc6442bf04
commit bfbe4fdd2f
35 changed files with 221 additions and 179 deletions

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package com.ibm.wala.core.tests.callGraph;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@ -61,7 +62,7 @@ public class CallGraphTest extends WalaTestCase {
}
public void testJava_cup() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testJava_cup() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.JAVA_CUP, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -71,7 +72,7 @@ public class CallGraphTest extends WalaTestCase {
doCallGraphs(options, new AnalysisCache(), cha, scope, useShortProfile(), false, true);
}
public void testBcelVerifier() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testBcelVerifier() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.BCEL, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -82,7 +83,7 @@ public class CallGraphTest extends WalaTestCase {
}
public void testJLex() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testJLex() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.JLEX, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util
@ -92,7 +93,7 @@ public class CallGraphTest extends WalaTestCase {
doCallGraphs(options,new AnalysisCache(), cha, scope, useShortProfile(), false);
}
public void testCornerCases() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testCornerCases() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = new AllApplicationEntrypoints(scope, cha);
@ -132,7 +133,7 @@ public class CallGraphTest extends WalaTestCase {
// doCallGraphs(options, cha, scope, Config.SPECJVM_DCG, false, false);
// }
//
public void testHello() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testHello() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.HELLO, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -142,7 +143,7 @@ public class CallGraphTest extends WalaTestCase {
doCallGraphs(options, new AnalysisCache(), cha, scope, false, false);
}
public void testRecursion() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testRecursion() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -152,7 +153,7 @@ public class CallGraphTest extends WalaTestCase {
doCallGraphs(options, new AnalysisCache(),cha, scope, useShortProfile(), false);
}
public void testHelloAllEntrypoints() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testHelloAllEntrypoints() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.HELLO, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = new AllApplicationEntrypoints(scope, cha);
@ -161,7 +162,7 @@ public class CallGraphTest extends WalaTestCase {
doCallGraphs(options, new AnalysisCache(),cha, scope, useShortProfile(), false);
}
public void testIO() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testIO() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope("primordial.txt", CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = makePrimordialPublicEntrypoints(scope, cha, "java/io");
@ -190,7 +191,7 @@ public class CallGraphTest extends WalaTestCase {
};
}
public void testPrimordial() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testPrimordial() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
if (useShortProfile()) {
return;
}

View File

@ -10,6 +10,8 @@
*******************************************************************************/
package com.ibm.wala.core.tests.callGraph;
import java.io.IOException;
import com.ibm.wala.eclipse.util.CancelException;
import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
@ -21,6 +23,7 @@ import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.util.Stopwatch;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.config.FileProvider;
import com.ibm.wala.util.debug.Trace;
/**
@ -51,8 +54,8 @@ public class CallGraphTestUtil {
// "J2SEClassHierarchyExclusions.txt", MY_CLASSLOADER);
// }
public static AnalysisScope makeJ2SEAnalysisScope(String scopeFile, String exclusionsFile) {
AnalysisScope scope = AnalysisScopeReader.read(scopeFile, exclusionsFile, MY_CLASSLOADER);
public static AnalysisScope makeJ2SEAnalysisScope(String scopeFile, String exclusionsFile) throws IOException {
AnalysisScope scope = AnalysisScopeReader.read(scopeFile, FileProvider.getFile(exclusionsFile), MY_CLASSLOADER);
return scope;
}

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package com.ibm.wala.core.tests.callGraph;
import java.io.IOException;
import java.util.Set;
import junit.framework.Assert;
@ -38,7 +39,7 @@ import com.ibm.wala.util.debug.Trace;
*/
public class ClassConstantTest extends WalaTestCase {
public void testClassConstants() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testClassConstants() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package com.ibm.wala.core.tests.callGraph;
import java.io.IOException;
import java.util.Iterator;
import java.util.Set;
@ -37,7 +38,7 @@ import com.ibm.wala.types.TypeReference;
*/
public class CloneTest extends WalaTestCase {
public void testClone() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testClone() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);

View File

@ -10,6 +10,8 @@
*******************************************************************************/
package com.ibm.wala.core.tests.callGraph;
import java.io.IOException;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.eclipse.util.CancelException;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
@ -41,7 +43,7 @@ public class DebuggingBitsetCallGraphTest extends WalaTestCase {
graphTest = new CallGraphTest(arg0);
}
private void runBitsetTest(MutableIntSetFactory p, MutableIntSetFactory s) throws ClassHierarchyException, IllegalArgumentException, CancelException {
private void runBitsetTest(MutableIntSetFactory p, MutableIntSetFactory s) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
MutableIntSetFactory save = IntSetUtil.getDefaultIntSetFactory();
try {
IntSetUtil.setDefaultIntSetFactory(new DebuggingMutableIntSetFactory(p, s));
@ -51,23 +53,23 @@ public class DebuggingBitsetCallGraphTest extends WalaTestCase {
}
}
public void testBimodalSparse() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testBimodalSparse() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
runBitsetTest(new BimodalMutableIntSetFactory(), new MutableSparseIntSetFactory());
}
public void testSharedBimodal() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testSharedBimodal() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
runBitsetTest(new MutableSharedBitVectorIntSetFactory(), new BimodalMutableIntSetFactory());
}
public void testSharedSparse() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testSharedSparse() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
runBitsetTest(new MutableSharedBitVectorIntSetFactory(), new MutableSparseIntSetFactory());
}
public void testSharedBitVector() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testSharedBitVector() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
runBitsetTest(new MutableSharedBitVectorIntSetFactory(), new BitVectorIntSetFactory());
}
public void testSemiSparseShared() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testSemiSparseShared() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
runBitsetTest(new SemiSparseMutableIntSetFactory(), new MutableSharedBitVectorIntSetFactory());
}

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package com.ibm.wala.core.tests.callGraph;
import java.io.IOException;
import java.util.Iterator;
import java.util.Set;
@ -69,7 +70,7 @@ public class PiNodeCallGraphTest extends WalaTestCase {
private static final MemberReference unary2Ref = MethodReference.findOrCreate(whateverRef,
Atom.findOrCreateUnicodeAtom("unary2"), Descriptor.findOrCreateUTF8("()V"));
private CallGraph doGraph(boolean usePiNodes) throws ClassHierarchyException, IllegalArgumentException, CancelException {
private CallGraph doGraph(boolean usePiNodes) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -101,11 +102,11 @@ public class PiNodeCallGraphTest extends WalaTestCase {
Assertions._assert(numberOfCalls == desiredNumberOfCalls);
}
public void testNoPiNodes() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testNoPiNodes() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
checkCallAssertions(doGraph(false), 2, 2);
}
public void testPiNodes() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testPiNodes() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
checkCallAssertions(doGraph(true), 1, 2);
}

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package com.ibm.wala.core.tests.callGraph;
import java.io.IOException;
import java.util.Iterator;
import com.ibm.wala.core.tests.util.TestConstants;
@ -37,7 +38,7 @@ public class ReflectionTest extends WalaTestCase {
justThisTest(ReflectionTest.class);
}
public void testReflect1() throws WalaException, IllegalArgumentException, CancelException {
public void testReflect1() throws WalaException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, "Java60RegressionExclusions.txt");
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.REFLECT1_MAIN);

View File

@ -17,13 +17,14 @@ import com.ibm.wala.classLoader.ClassLoaderFactoryImpl;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.config.FileProvider;
/**
* Test ClassHierarchy.getPossibleTargets
@ -41,7 +42,7 @@ public class GetTargetsTest extends WalaTestCase {
protected void setUp() throws Exception {
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.xml"), MY_CLASSLOADER);
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions() );

View File

@ -15,13 +15,14 @@ import com.ibm.wala.classLoader.ClassLoaderFactoryImpl;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.TypeName;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.config.FileProvider;
/**
* Test interface subtype stuff
@ -38,7 +39,7 @@ public class InterfaceTest extends WalaTestCase {
}
protected void setUp() throws Exception {
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.xml"), MY_CLASSLOADER);
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions() );

View File

@ -10,13 +10,16 @@
*******************************************************************************/
package com.ibm.wala.core.tests.cha;
import java.io.IOException;
import junit.framework.Assert;
import com.ibm.wala.core.tests.ir.DeterministicIRTest;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.config.FileProvider;
/**
* Test code that attempts to find the library version from
@ -28,8 +31,8 @@ public class LibraryVersionTest extends WalaTestCase {
private static final ClassLoader MY_CLASSLOADER = DeterministicIRTest.class.getClassLoader();
public void testLibraryVersion() {
AnalysisScope scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
public void testLibraryVersion() throws IOException {
AnalysisScope scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.xml"), MY_CLASSLOADER);
System.err.println("java library version is " + scope.getJavaLibraryVersion());
Assert.assertTrue(scope.isJava16Libraries() || scope.isJava15Libraries()||scope.isJava14Libraries());
}

View File

@ -37,6 +37,7 @@
*/
package com.ibm.wala.core.tests.demandpa;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
@ -142,7 +143,7 @@ public abstract class AbstractPtrTest extends TestCase {
protected AnalysisScope scope = null;
protected void doPointsToSizeTest(String scopeFile, String mainClass, int expected14Size, int expected15Size, int expected16Size)
throws ClassHierarchyException, IllegalArgumentException, CancelException {
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
if (Assertions.verifyAssertions) {
Assertions._assert(scope == null);
}
@ -167,12 +168,12 @@ public abstract class AbstractPtrTest extends TestCase {
}
protected void doPointsToSizeTest(String scopeFile, String mainClass, int expectedSize) throws ClassHierarchyException,
IllegalArgumentException, CancelException {
IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(scopeFile, mainClass, expectedSize, expectedSize, expectedSize);
}
protected Collection<InstanceKey> getPointsToSetToTest(String scopeFile, String mainClass) throws ClassHierarchyException,
IllegalArgumentException, CancelException {
IllegalArgumentException, CancelException, IOException {
final IDemandPointerAnalysis dmp = makeDemandPointerAnalysis(scopeFile, mainClass);
// find the testThisVar call, and check the parameter's points-to set
@ -183,7 +184,7 @@ public abstract class AbstractPtrTest extends TestCase {
}
protected DemandRefinementPointsTo makeDemandPointerAnalysis(String scopeFile, String mainClass) throws ClassHierarchyException,
IllegalArgumentException, CancelException {
IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(scopeFile, "Java60RegressionExclusions.txt");
this.scope = scope;
// build a type hierarchy

View File

@ -37,6 +37,7 @@
*/
package com.ibm.wala.core.tests.demandpa;
import java.io.IOException;
import java.util.Collection;
import com.ibm.wala.demandpa.alg.ContextSensitiveStateMachine;
@ -63,19 +64,19 @@ public class ContextSensitiveTest extends AbstractPtrTest {
WalaUtil.initializeTraceFile();
}
public void testArraySet() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testArraySet() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ARRAY_SET, 1);
}
public void testClone() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testClone() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_CLONE, 1);
}
public void testFooId() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testFooId() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ID, 1);
}
public void testHashtableEnum() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testHashtableEnum() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
// 3 because
// can't tell between key, value, and entry enumerators in Hashtable
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_HASHTABLE_ENUM, 3);
@ -102,7 +103,7 @@ public class ContextSensitiveTest extends AbstractPtrTest {
// assertEquals(1, pointsTo.size());
// }
public void testWithinMethodCall() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testWithinMethodCall() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
String mainClass = TestInfo.TEST_WITHIN_METHOD_CALL;
final IDemandPointerAnalysis dmp = makeDemandPointerAnalysis(TestInfo.SCOPE_FILE, mainClass);
@ -116,35 +117,35 @@ public class ContextSensitiveTest extends AbstractPtrTest {
assertEquals(1, pointsTo.size());
}
public void testLinkedListIter() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testLinkedListIter() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_LINKEDLIST_ITER, 1);
}
public void testGlobal() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testGlobal() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_GLOBAL, 1);
}
public void testHashSet() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testHashSet() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_HASH_SET, 2, 2, 1);
}
public void testHashMapGet() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testHashMapGet() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_HASHMAP_GET, 2, 1, 1);
}
public void testMethodRecursion() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testMethodRecursion() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_METHOD_RECURSION, 2);
}
public void testArraySetIter() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testArraySetIter() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ARRAY_SET_ITER, 1);
}
public void testArrayList() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testArrayList() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ARRAY_LIST, 1);
}
public void testLinkedList() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testLinkedList() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_LINKED_LIST, 1);
}
@ -154,7 +155,7 @@ public class ContextSensitiveTest extends AbstractPtrTest {
}
@Override
protected DemandRefinementPointsTo makeDemandPointerAnalysis(String scopeFile, String mainClass) throws ClassHierarchyException, IllegalArgumentException, CancelException {
protected DemandRefinementPointsTo makeDemandPointerAnalysis(String scopeFile, String mainClass) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
DemandRefinementPointsTo dmp = super.makeDemandPointerAnalysis(scopeFile, mainClass);
dmp.setRefinementPolicyFactory(new SinglePassRefinementPolicy.Factory(new AlwaysRefineFieldsPolicy(),
new AlwaysRefineCGPolicy()));

View File

@ -37,6 +37,8 @@
*/
package com.ibm.wala.core.tests.demandpa;
import java.io.IOException;
import com.ibm.wala.demandpa.alg.IntraProcFilter;
import com.ibm.wala.demandpa.alg.statemachine.StateMachineFactory;
import com.ibm.wala.demandpa.flowgraph.IFlowLabel;
@ -45,7 +47,7 @@ import com.ibm.wala.ipa.cha.ClassHierarchyException;
public class IntraprocTest extends AbstractPtrTest {
public void testId() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testId() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ID, 0);
}

View File

@ -37,6 +37,8 @@
*/
package com.ibm.wala.core.tests.demandpa;
import java.io.IOException;
import com.ibm.wala.demandpa.util.WalaUtil;
import com.ibm.wala.eclipse.util.CancelException;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
@ -48,59 +50,59 @@ public class NoRefinePtrTest extends AbstractPtrTest {
WalaUtil.initializeTraceFile();
}
public void testOnTheFlySimple() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testOnTheFlySimple() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ONTHEFLY_SIMPLE, 2);
}
public void testArraySet() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testArraySet() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ARRAY_SET, 2);
}
public void testArraySetIter() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testArraySetIter() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ARRAY_SET_ITER, 2);
}
public void testHashSet() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testHashSet() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_HASH_SET, 5, 5, 4);
}
public void testMethodRecursion() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testMethodRecursion() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_METHOD_RECURSION, 2);
}
public void testFooId() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testFooId() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ID, 2);
}
public void testLocals() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testLocals() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_LOCALS, 1);
}
public void testArrays() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testArrays() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ARRAYS, 3);
}
public void testFields() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testFields() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_FIELDS, 2);
}
public void testFieldsHarder() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testFieldsHarder() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_FIELDS_HARDER, 2);
}
public void testGetterSetter() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testGetterSetter() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_GETTER_SETTER, 2);
}
public void testException() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testException() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_EXCEPTION, 4);
}
public void testMultiDim() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testMultiDim() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_MULTI_DIM, 5);
}
public void testGlobal() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testGlobal() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_GLOBAL, 1);
}

View File

@ -37,6 +37,8 @@
*/
package com.ibm.wala.core.tests.demandpa;
import java.io.IOException;
import com.ibm.wala.demandpa.alg.DemandRefinementPointsTo;
import com.ibm.wala.demandpa.alg.refinepolicy.AlwaysRefineCGPolicy;
import com.ibm.wala.demandpa.alg.refinepolicy.AlwaysRefineFieldsPolicy;
@ -46,12 +48,12 @@ import com.ibm.wala.ipa.cha.ClassHierarchyException;
public class OnTheFlyPtrTest extends AbstractPtrTest {
public void testOnTheFlySimple() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testOnTheFlySimple() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ONTHEFLY_SIMPLE, 1);
}
@Override
protected DemandRefinementPointsTo makeDemandPointerAnalysis(String scopeFile, String mainClass) throws ClassHierarchyException, IllegalArgumentException, CancelException {
protected DemandRefinementPointsTo makeDemandPointerAnalysis(String scopeFile, String mainClass) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
DemandRefinementPointsTo dmp = super.makeDemandPointerAnalysis(scopeFile, mainClass);
dmp.setRefinementPolicyFactory(new SinglePassRefinementPolicy.Factory(new AlwaysRefineFieldsPolicy(),
new AlwaysRefineCGPolicy()));

View File

@ -37,6 +37,8 @@
*/
package com.ibm.wala.core.tests.demandpa;
import java.io.IOException;
import com.ibm.wala.demandpa.alg.DemandRefinementPointsTo;
import com.ibm.wala.demandpa.alg.refinepolicy.AlwaysRefineFieldsPolicy;
import com.ibm.wala.demandpa.alg.refinepolicy.NeverRefineCGPolicy;
@ -46,44 +48,45 @@ import com.ibm.wala.ipa.cha.ClassHierarchyException;
public class RefineFieldsPtrTest extends AbstractPtrTest {
public void testNastyPtrs() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testNastyPtrs() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_NASTY_PTRS, 10);
}
public void testGlobal() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testGlobal() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_GLOBAL, 1);
}
public void testFields() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testFields() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_FIELDS, 1);
}
public void testFieldsHarder() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testFieldsHarder() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_FIELDS_HARDER, 1);
}
public void testArrays() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testArrays() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ARRAYS, 2);
}
public void testGetterSetter() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testGetterSetter() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_GETTER_SETTER, 1);
}
public void testArraySet() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testArraySet() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ARRAY_SET, 2);
}
public void testArraySetIter() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testArraySetIter() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_ARRAY_SET_ITER, 2);
}
public void testMultiDim() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testMultiDim() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
doPointsToSizeTest(TestInfo.SCOPE_FILE, TestInfo.TEST_MULTI_DIM, 2);
}
@Override
public DemandRefinementPointsTo makeDemandPointerAnalysis(String scopeFile, String mainClass) throws ClassHierarchyException, IllegalArgumentException, CancelException {
public DemandRefinementPointsTo makeDemandPointerAnalysis(String scopeFile, String mainClass) throws ClassHierarchyException,
IllegalArgumentException, CancelException, IOException {
DemandRefinementPointsTo dmp = super.makeDemandPointerAnalysis(scopeFile, mainClass);
dmp
.setRefinementPolicyFactory(new SinglePassRefinementPolicy.Factory(new AlwaysRefineFieldsPolicy(),

View File

@ -14,17 +14,17 @@ import com.ibm.wala.cfg.ControlFlowGraph;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.ISSABasicBlock;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.util.StringStuff;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.config.FileProvider;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
import com.ibm.wala.util.graph.GraphIntegrity;
@ -44,7 +44,7 @@ public class CFGTest extends WalaTestCase {
*/
private void doMethod(String methodSig) {
try {
AnalysisScope scope = AnalysisScopeReader.makePrimordialScope(CallGraphTestUtil.REGRESSION_EXCLUSIONS);
AnalysisScope scope = AnalysisScopeReader.makePrimordialScope(FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
ClassHierarchy cha = ClassHierarchy.make(scope);

View File

@ -10,13 +10,14 @@
*******************************************************************************/
package com.ibm.wala.core.tests.ir;
import java.io.IOException;
import com.ibm.wala.analysis.typeInference.TypeInference;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.ShrikeCTMethod;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
@ -28,6 +29,8 @@ import com.ibm.wala.types.Descriptor;
import com.ibm.wala.types.Selector;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.config.FileProvider;
/**
* tests for weird corner cases, such as when the input program doesn't verify
@ -43,10 +46,11 @@ public class CornerCasesTest extends WalaTestCase {
* exist
*
* @throws ClassHierarchyException
* @throws IOException
*/
public void testBug38484() throws ClassHierarchyException {
public void testBug38484() throws ClassHierarchyException, IOException {
AnalysisScope scope = null;
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.xml"), MY_CLASSLOADER);
ClassHierarchy cha = ClassHierarchy.make(scope);
TypeReference t = TypeReference.findOrCreateClass(scope.getApplicationLoader(), "cornerCases", "YuckyInterface");
IClass klass = cha.lookupClass(t);
@ -60,10 +64,11 @@ public class CornerCasesTest extends WalaTestCase {
* field's declared type cannot be loaded
*
* @throws ClassHierarchyException
* @throws IOException
*/
public void testBug38540() throws ClassHierarchyException {
public void testBug38540() throws ClassHierarchyException, IOException {
AnalysisScope scope = null;
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.xml"), MY_CLASSLOADER);
AnalysisOptions options = new AnalysisOptions();
ClassHierarchy cha = ClassHierarchy.make(scope);
TypeReference t = TypeReference.findOrCreateClass(scope.getApplicationLoader(), "cornerCases", "Main");

View File

@ -17,7 +17,6 @@ import com.ibm.wala.classLoader.ClassLoaderFactoryImpl;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
@ -30,6 +29,8 @@ import com.ibm.wala.types.MethodReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.ImmutableByteArray;
import com.ibm.wala.util.UTF8Convert;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.config.FileProvider;
import com.ibm.wala.util.graph.GraphIntegrity;
import com.ibm.wala.util.graph.GraphIntegrity.UnsoundGraphException;
import com.ibm.wala.util.warnings.Warnings;
@ -59,8 +60,7 @@ public class DeterministicIRTest extends WalaTestCase {
protected void setUp() throws Exception {
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.xml"), MY_CLASSLOADER);
options = new AnalysisOptions(scope, null);
cache = new AnalysisCache();
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions() );

View File

@ -16,7 +16,6 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
@ -32,6 +31,8 @@ import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.ImmutableByteArray;
import com.ibm.wala.util.UTF8Convert;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.config.FileProvider;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.debug.Trace;
@ -41,31 +42,30 @@ import com.ibm.wala.util.debug.Trace;
public class LocalNamesTest extends WalaTestCase {
private static final ClassLoader MY_CLASSLOADER = LocalNamesTest.class.getClassLoader();
private AnalysisScope scope;
private ClassHierarchy cha;
private AnalysisOptions options;
private AnalysisCache cache;
public static void main(String[] args) {
justThisTest(LocalNamesTest.class);
}
/*
* (non-Javadoc)
*
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.xml"),
MY_CLASSLOADER);
options = new AnalysisOptions(scope, null);
cache = new AnalysisCache();
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions() );
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions());
try {
cha = ClassHierarchy.make(scope, factory);
@ -90,16 +90,18 @@ public class LocalNamesTest extends WalaTestCase {
*/
public void testAliasNames() {
try {
AnalysisScope scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
AnalysisScope scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, FileProvider
.getFile("J2SEClassHierarchyExclusions.xml"), MY_CLASSLOADER);
ClassHierarchy cha = ClassHierarchy.make(scope);
TypeReference t = TypeReference.findOrCreateClass(scope.getApplicationLoader(), "cornerCases", "AliasNames");
IClass klass = cha.lookupClass(t);
assertTrue(klass != null);
IMethod m = klass.getMethod(new Selector(Atom.findOrCreateAsciiAtom("foo"), Descriptor.findOrCreateUTF8("([Ljava/lang/String;)V")));
IMethod m = klass.getMethod(new Selector(Atom.findOrCreateAsciiAtom("foo"), Descriptor
.findOrCreateUTF8("([Ljava/lang/String;)V")));
AnalysisOptions options = new AnalysisOptions();
options.getSSAOptions().setUsePiNodes(true);
IR ir = cache.getSSACache().findOrCreateIR(m, Everywhere.EVERYWHERE, options.getSSAOptions() );
IR ir = cache.getSSACache().findOrCreateIR(m, Everywhere.EVERYWHERE, options.getSSAOptions());
for (int offsetIndex = 0; offsetIndex < ir.getInstructions().length; offsetIndex++) {
SSAInstruction instr = ir.getInstructions()[offsetIndex];
@ -107,7 +109,8 @@ public class LocalNamesTest extends WalaTestCase {
String[] localNames = ir.getLocalNames(offsetIndex, instr.getDef());
if (localNames != null && localNames.length > 0 && localNames[0] == null) {
Trace.println(ir);
assertTrue(" getLocalNames() returned [null,...] for the def of instruction at offset " + offsetIndex + "\n\tinstr", false);
assertTrue(" getLocalNames() returned [null,...] for the def of instruction at offset " + offsetIndex + "\n\tinstr",
false);
}
}
}
@ -125,18 +128,18 @@ public class LocalNamesTest extends WalaTestCase {
assertNotNull("method not found", mref);
IMethod imethod = cha.resolveMethod(mref);
assertNotNull("imethod not found", imethod);
IR ir = cache.getIRFactory().makeIR(imethod, Everywhere.EVERYWHERE, options.getSSAOptions());
IR ir = cache.getIRFactory().makeIR(imethod, Everywhere.EVERYWHERE, options.getSSAOptions());
options.getSSAOptions().setUsePiNodes(save);
// v1 should be the parameter "a" at pc 0
String[] names = ir.getLocalNames(0, 1);
assertTrue("failed local name resolution for v1@0", names != null);
assertTrue("incorrect number of local names for v1@0: " + names.length, names.length == 1);
assertTrue("incorrect local name resolution for v1@0: " + names[0], names[0].equals("a"));
// v2 is a compiler-induced temporary
assertTrue("didn't expect name for v2 at pc 2", ir.getLocalNames(2, 2) == null);
// at pc 5, v1 should represent the locals "a" and "b"
names = ir.getLocalNames(5, 1);
assertTrue("failed local name resolution for v1@5", names != null);
@ -153,18 +156,18 @@ public class LocalNamesTest extends WalaTestCase {
assertNotNull("method not found", mref);
IMethod imethod = cha.resolveMethod(mref);
assertNotNull("imethod not found", imethod);
IR ir = cache.getIRFactory().makeIR(imethod, Everywhere.EVERYWHERE, options.getSSAOptions());
IR ir = cache.getIRFactory().makeIR(imethod, Everywhere.EVERYWHERE, options.getSSAOptions());
options.getSSAOptions().setUsePiNodes(save);
// v1 should be the parameter "a" at pc 0
String[] names = ir.getLocalNames(0, 1);
assertTrue("failed local name resolution for v1@0", names != null);
assertTrue("incorrect number of local names for v1@0: " + names.length, names.length == 1);
assertTrue("incorrect local name resolution for v1@0: " + names[0], names[0].equals("a"));
// v2 is a compiler-induced temporary
assertTrue("didn't expect name for v2 at pc 2", ir.getLocalNames(2, 2) == null);
// at pc 5, v1 should represent the locals "a" and "b"
names = ir.getLocalNames(5, 1);
assertTrue("failed local name resolution for v1@5", names != null);

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package com.ibm.wala.core.tests.ptrs;
import java.io.IOException;
import java.util.Iterator;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
@ -53,7 +54,7 @@ public class MultiDimArrayTest extends WalaTestCase {
super(arg0);
}
public void testMultiDim() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testMultiDim() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util

View File

@ -13,6 +13,7 @@ package com.ibm.wala.core.tests.slicer;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Collections;
@ -58,7 +59,7 @@ import com.ibm.wala.util.intset.IntSet;
public class SlicerTest extends TestCase {
public void testSlice1() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testSlice1() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -87,7 +88,7 @@ public class SlicerTest extends TestCase {
assertEquals(16, i);
}
public void testSlice2() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testSlice2() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -109,7 +110,7 @@ public class SlicerTest extends TestCase {
assertEquals(22, slice.size());
}
public void testSlice3() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testSlice3() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -130,7 +131,7 @@ public class SlicerTest extends TestCase {
assertEquals(1, countAllocations(slice));
}
public void testSlice4() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testSlice4() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -151,7 +152,7 @@ public class SlicerTest extends TestCase {
assertEquals(4, slice.size());
}
public void testSlice5() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testSlice5() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -176,8 +177,9 @@ public class SlicerTest extends TestCase {
* test unreproduced bug reported on mailing list by Sameer Madan, 7/3/2007
* @throws CancelException
* @throws IllegalArgumentException
* @throws IOException
*/
public void testSlice7() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testSlice7() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -196,7 +198,7 @@ public class SlicerTest extends TestCase {
dumpSlice(slice);
}
public void testTestCD1() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestCD1() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -217,7 +219,7 @@ public class SlicerTest extends TestCase {
assertEquals(2, countConditionals(slice));
}
public void testTestCD2() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestCD2() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -238,7 +240,7 @@ public class SlicerTest extends TestCase {
assertEquals(1, countConditionals(slice));
}
public void testTestCD3() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestCD3() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -259,7 +261,7 @@ public class SlicerTest extends TestCase {
assertEquals(0, countConditionals(slice));
}
public void testTestId() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestId() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -280,7 +282,7 @@ public class SlicerTest extends TestCase {
assertEquals(1, countAllocations(slice));
}
public void testTestArrays() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestArrays() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -302,7 +304,7 @@ public class SlicerTest extends TestCase {
assertEquals(1, countAloads(slice));
}
public void testTestFields() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestFields() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -324,7 +326,7 @@ public class SlicerTest extends TestCase {
assertEquals(1, countPutfields(slice));
}
public void testThin1() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testThin1() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -356,7 +358,7 @@ public class SlicerTest extends TestCase {
assertEquals(1, countPutfields(slice));
}
public void testTestGlobal() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestGlobal() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -379,7 +381,7 @@ public class SlicerTest extends TestCase {
assertEquals(2, countGetstatics(slice));
}
public void testTestMultiTarget() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestMultiTarget() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -400,7 +402,7 @@ public class SlicerTest extends TestCase {
assertEquals(2, countAllocations(slice));
}
public void testTestRecursion() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestRecursion() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -423,7 +425,7 @@ public class SlicerTest extends TestCase {
assertEquals(2, countPutfields(slice));
}
public void testPrimGetterSetter() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testPrimGetterSetter() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -448,7 +450,7 @@ public class SlicerTest extends TestCase {
assertEquals(1, countPutfields(slice));
}
public void testTestThrowCatch() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestThrowCatch() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
@ -471,7 +473,7 @@ public class SlicerTest extends TestCase {
assertEquals(1, countGetfields(slice));
}
public void testTestMessageFormat() throws ClassHierarchyException, IllegalArgumentException, CancelException {
public void testTestMessageFormat() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,

View File

@ -16,7 +16,6 @@ import com.ibm.wala.classLoader.ClassLoaderFactoryImpl;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.core.tests.util.TestConstants;
import com.ibm.wala.core.tests.util.WalaTestCase;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
@ -28,6 +27,8 @@ import com.ibm.wala.types.MethodReference;
import com.ibm.wala.util.Atom;
import com.ibm.wala.util.ImmutableByteArray;
import com.ibm.wala.util.UTF8Convert;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.config.FileProvider;
import com.ibm.wala.util.warnings.Warnings;
/**
@ -46,7 +47,7 @@ public class TypeInferenceTest extends WalaTestCase {
private ClassHierarchy cha;
private AnalysisOptions options;
private AnalysisCache cache;
public static void main(String[] args) {
@ -55,11 +56,11 @@ public class TypeInferenceTest extends WalaTestCase {
protected void setUp() throws Exception {
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, "J2SEClassHierarchyExclusions.xml", MY_CLASSLOADER);
scope = AnalysisScopeReader.read(TestConstants.WALA_TESTDATA, FileProvider.getFile("J2SEClassHierarchyExclusions.xml"), MY_CLASSLOADER);
options = new AnalysisOptions(scope, null);
cache = new AnalysisCache();
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions() );
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions());
try {
cha = ClassHierarchy.make(scope, factory);
@ -81,11 +82,11 @@ public class TypeInferenceTest extends WalaTestCase {
assertNotNull("method not found", method);
IMethod imethod = cha.resolveMethod(method);
assertNotNull("imethod not found", imethod);
IR ir = cache.getIRFactory().makeIR(imethod, Everywhere.EVERYWHERE, options.getSSAOptions() );
IR ir = cache.getIRFactory().makeIR(imethod, Everywhere.EVERYWHERE, options.getSSAOptions());
System.out.println(ir);
TypeInference ti = TypeInference.make(ir, false);
for (int i = 1; i<= ir.getSymbolTable().getMaxValueNumber(); i++) {
for (int i = 1; i <= ir.getSymbolTable().getMaxValueNumber(); i++) {
System.err.println(i + " " + ti.getType(i));
}
}

View File

@ -29,6 +29,8 @@
*/
package com.ibm.wala.demandpa.driver;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
@ -87,7 +89,7 @@ public class CompareToZeroOneCFADriver {
}
@SuppressWarnings("unused")
private static void runUnitTestCase(String mainClass) throws IllegalArgumentException, CancelException {
private static void runUnitTestCase(String mainClass) throws IllegalArgumentException, CancelException, IOException {
Trace.println("=======---------------=============");
Trace.println("ANALYZING " + mainClass + "\n\n");
// describe the "scope", what is the program we're analyzing
@ -118,7 +120,7 @@ public class CompareToZeroOneCFADriver {
Trace.println("=======---------------=============");
Trace.println("ANALYZING " + appJar + "\n\n");
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
// TODO: return the warning set (need a CAPA type)
// invoke DOMO to build a DOMO class hierarchy object

View File

@ -29,6 +29,7 @@
*/
package com.ibm.wala.demandpa.driver;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@ -96,8 +97,9 @@ public class DemandCastChecker {
* @param args
* @throws CancelException
* @throws IllegalArgumentException
* @throws IOException
*/
public static void main(String[] args) throws IllegalArgumentException, CancelException {
public static void main(String[] args) throws IllegalArgumentException, CancelException, IOException {
WalaUtil.initializeTraceFile();
try {
p = new Properties();
@ -121,7 +123,7 @@ public class DemandCastChecker {
runTestCase("Lpolyglot/main/Main", "polyglot.xml", "polyglot");
}
private static void runTestCase(String mainClass, String scopeFile, String benchName) throws IllegalArgumentException, CancelException {
private static void runTestCase(String mainClass, String scopeFile, String benchName) throws IllegalArgumentException, CancelException, IOException {
Trace.println("=====BENCHMARK " + benchName + "=====");
System.err.println("analyzing " + benchName);
DemandRefinementPointsTo dmp = null;
@ -140,7 +142,7 @@ public class DemandCastChecker {
}
private static DemandRefinementPointsTo makeDemandPointerAnalysis(String scopeFile, String mainClass, String benchName)
throws ClassHierarchyException, IllegalArgumentException, CancelException {
throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(scopeFile, getExclusions(benchName));
// build a type hierarchy
ClassHierarchy cha = ClassHierarchy.make(scope);

View File

@ -29,6 +29,7 @@
*/
package com.ibm.wala.demandpa.driver;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
@ -74,7 +75,7 @@ public class TestAgainstSimpleDriver {
private static final boolean VERBOSE = false;
public static void main(String[] args) throws IllegalArgumentException, CancelException {
public static void main(String[] args) throws IllegalArgumentException, CancelException, IOException {
WalaUtil.initializeTraceFile();
// for (String String : ALL_TEST_CASES) {
@ -84,7 +85,7 @@ public class TestAgainstSimpleDriver {
System.err.println("computed all points-to sets successfully");
}
private static void runAnalysisForTestCase(String mainClass) throws IllegalArgumentException, CancelException {
private static void runAnalysisForTestCase(String mainClass) throws IllegalArgumentException, CancelException, IOException {
Trace.println("=======---------------=============");
Trace.println("ANALYZING " + mainClass + "\n\n");
// describe the "scope", what is the program we're analyzing

View File

@ -15,12 +15,10 @@ import java.util.Properties;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.eclipse.util.CancelException;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.examples.properties.WalaExamplesProperties;
import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.Entrypoint;
@ -30,6 +28,7 @@ import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.collections.Filter;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.io.CommandLine;
@ -49,22 +48,24 @@ public class GVCallGraph {
private final static String PS_FILE = "cg.ps";
/**
* Usage: args = "-appJar [jar file name] {-exclusionFile [exclusionFileName]}"
* The "jar file name" should be
* something like "c:/temp/testdata/java_cup.jar"
* @throws CancelException
* @throws IllegalArgumentException
* Usage: args = "-appJar [jar file name] {-exclusionFile
* [exclusionFileName]}" The "jar file name" should be something like
* "c:/temp/testdata/java_cup.jar"
*
* @throws CancelException
* @throws IllegalArgumentException
*/
public static void main(String[] args) throws WalaException, IllegalArgumentException, CancelException {
run(args);
}
/**
* Usage: args = "-appJar [jar file name] {-exclusionFile [exclusionFileName]}"
* The "jar file name" should be
* something like "c:/temp/testdata/java_cup.jar"
* @throws CancelException
* @throws IllegalArgumentException
* Usage: args = "-appJar [jar file name] {-exclusionFile
* [exclusionFileName]}" The "jar file name" should be something like
* "c:/temp/testdata/java_cup.jar"
*
* @throws CancelException
* @throws IllegalArgumentException
*/
public static Process run(String[] args) throws WalaException, IllegalArgumentException, CancelException {
Properties p = CommandLine.parse(args);
@ -81,7 +82,7 @@ public class GVCallGraph {
public static Process run(String appJar, String exclusionFile) throws IllegalArgumentException, CancelException {
try {
Graph<CGNode> g = buildPrunedCallGraph(appJar, exclusionFile);
Graph<CGNode> g = buildPrunedCallGraph(appJar, new File(exclusionFile));
Properties p = null;
try {
@ -108,19 +109,16 @@ public class GVCallGraph {
/**
* @param appJar
* something like "c:/temp/testdata/java_cup.jar"
* something like "c:/temp/testdata/java_cup.jar"
* @return a call graph
* @throws CancelException
* @throws IllegalArgumentException
* @throws CancelException
* @throws IllegalArgumentException
*/
public static Graph<CGNode> buildPrunedCallGraph(String appJar, String exclusionFile) throws WalaException, IllegalArgumentException, CancelException {
AnalysisScope scope =
AnalysisScopeReader.makeJavaBinaryAnalysisScope(
appJar,
exclusionFile != null?
exclusionFile:
CallGraphTestUtil.REGRESSION_EXCLUSIONS);
public static Graph<CGNode> buildPrunedCallGraph(String appJar, File exclusionFile) throws WalaException,
IllegalArgumentException, CancelException {
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, exclusionFile != null ? exclusionFile
: new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha);
@ -129,7 +127,8 @@ public class GVCallGraph {
// //
// build the call graph
// //
com.ibm.wala.ipa.callgraph.CallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCache(),cha, scope, null, null);
com.ibm.wala.ipa.callgraph.CallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCache(), cha, scope, null,
null);
CallGraph cg = builder.makeCallGraph(options);
Graph<CGNode> g = pruneForAppLoader(cg);
@ -149,7 +148,7 @@ public class GVCallGraph {
* <li> args[1] : something like "c:/temp/testdata/java_cup.jar" </ul?
*
* @throws UnsupportedOperationException
* if command-line is malformed.
* if command-line is malformed.
*/
public static void validateCommandLine(Properties p) {
if (p.get("appJar") == null) {

View File

@ -82,7 +82,7 @@ public class GVControlDependenceGraph {
if (SWTCallGraph.isDirectory(appJar)) {
appJar = SWTCallGraph.findJarFiles(new String[] { appJar });
}
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
ClassHierarchy cha = ClassHierarchy.make(scope);

View File

@ -111,7 +111,7 @@ public class GVSDG {
*/
public static Process run(String appJar, String mainClass, DataDependenceOptions dOptions, ControlDependenceOptions cOptions) throws IllegalArgumentException, CancelException {
try {
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
// generate a WALA-consumable wrapper around the incoming scope object

View File

@ -156,7 +156,7 @@ public class GVSlice {
DataDependenceOptions dOptions, ControlDependenceOptions cOptions) throws IllegalArgumentException, CancelException {
try {
// create an analysis scope representing the appJar as a J2SE application
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
// build a class hierarchy, call graph, and system dependence graph

View File

@ -65,7 +65,7 @@ public class GVTypeHierarchy {
try {
SWTTypeHierarchy.validateCommandLine(args);
String classpath = args[SWTTypeHierarchy.CLASSPATH_INDEX];
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
// generate a WALA-consumable wrapper around the incoming scope object

View File

@ -76,9 +76,7 @@ public class GVWalaIR {
if (SWTCallGraph.isDirectory(appJar)) {
appJar = SWTCallGraph.findJarFiles(new String[] { appJar });
}
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
ClassHierarchy cha = ClassHierarchy.make(scope);

View File

@ -94,8 +94,8 @@ public class SWTCallGraph {
String exclusionFile = p.getProperty("exclusions");
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, exclusionFile != null ? exclusionFile
: CallGraphTestUtil.REGRESSION_EXCLUSIONS);
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, exclusionFile != null ? new File(exclusionFile)
: new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
ClassHierarchy cha = ClassHierarchy.make(scope);

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package com.ibm.wala.examples.drivers;
import java.io.File;
import java.util.Properties;
import org.eclipse.jface.window.ApplicationWindow;
@ -78,7 +79,7 @@ public class SWTPointsTo {
}
public static Graph<Object> buildPointsTo(String appJar) throws WalaException, IllegalArgumentException, CancelException {
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
ClassHierarchy cha = ClassHierarchy.make(scope);

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package com.ibm.wala.examples.drivers;
import java.io.File;
import java.util.Collection;
import org.eclipse.jface.viewers.TreeViewer;
@ -59,7 +60,7 @@ public class SWTTypeHierarchy {
public static ApplicationWindow run(String classpath) {
try {
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
// generate a WALA-consumable wrapper around the incoming scope object