refactoring: rename some Util classes

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4492 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
msridhar1 2012-02-17 20:21:59 +00:00
parent 92d8dc1e3d
commit a3826f23a8
23 changed files with 130 additions and 122 deletions

View File

@ -15,7 +15,7 @@ import com.ibm.wala.cast.js.ipa.callgraph.ForInContextSelector;
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
import com.ibm.wala.cast.js.ipa.callgraph.JavaScriptFunctionDotCallTargetSelector;
import com.ibm.wala.cast.js.ipa.callgraph.correlations.extraction.CorrelatedPairExtractorFactory;
import com.ibm.wala.cast.js.test.Util;
import com.ibm.wala.cast.js.test.JSCallGraphBuilderUtil;
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphBuilderCancelException;
@ -76,12 +76,12 @@ public class HTMLCGBuilder {
} catch (MalformedURLException e1) {
Assert.fail("Could not find page to analyse: " + src);
}
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
if(automated_extraction)
com.ibm.wala.cast.js.ipa.callgraph.Util.setPreprocessor(new CorrelatedPairExtractorFactory(new CAstRhinoTranslatorFactory(), url));
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setPreprocessor(new CorrelatedPairExtractorFactory(new CAstRhinoTranslatorFactory(), url));
JSCFABuilder builder = null;
try {
builder = Util.makeHTMLCGBuilder(url);
builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
builder.setContextSelector(new ForInContextSelector(2, builder.getContextSelector()));
builder.setContextSelector(new ForInContextSelector(3, builder.getContextSelector()));
ProgressMaster master = ProgressMaster.make(new NullProgressMonitor());

View File

@ -22,7 +22,7 @@ public class TestAjaxsltCallGraphShapeRhino extends TestAjaxsltCallGraphShape {
@Before
public void setUp() {
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}

View File

@ -8,7 +8,7 @@ public class TestForInLoopHackRhino extends TestForInLoopHack {
@Before
public void setUp() {
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}
}

View File

@ -22,7 +22,7 @@ public class TestMediawikiCallGraphShapeRhino extends TestMediawikiCallGraphShap
@Before
public void setUp() {
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}
}

View File

@ -12,7 +12,7 @@ public class TestMozillaBugPagesRhino extends TestMozillaBugPages {
@Before
public void setUp() {
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}
}

View File

@ -28,12 +28,12 @@ public class TestSimpleCallGraphShapeRhino extends TestSimpleCallGraphShape {
@Before
public void setUp() {
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}
@Test
public void test214631() throws IOException, IllegalArgumentException, CancelException {
JSCFABuilder b = Util.makeScriptCGBuilder("tests", "214631.js");
JSCFABuilder b = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "214631.js");
b.makeCallGraph(b.getOptions());
PointerAnalysis PA = b.getPointerAnalysis();
// just make sure this does not crash
@ -42,23 +42,23 @@ public class TestSimpleCallGraphShapeRhino extends TestSimpleCallGraphShape {
@Test
public void testRewriterDoesNotChangeLablesBug() throws IOException, IllegalArgumentException, CancelException {
Util.makeScriptCG("tests", "rewrite_does_not_change_lables_bug.js");
JSCallGraphBuilderUtil.makeScriptCG("tests", "rewrite_does_not_change_lables_bug.js");
// all we need is for it to finish building CG successfully.
}
@Test
public void testRepr() throws IllegalArgumentException, IOException, CancelException {
Util.makeScriptCG("tests", "repr.js");
JSCallGraphBuilderUtil.makeScriptCG("tests", "repr.js");
}
@Test
public void testTranslateToCAstCrash1() throws IllegalArgumentException, IOException, CancelException {
Util.makeScriptCG("tests", "rhino_crash1.js");
JSCallGraphBuilderUtil.makeScriptCG("tests", "rhino_crash1.js");
}
@Test
public void testTranslateToCAstCrash2() throws IllegalArgumentException, IOException, CancelException {
Util.makeScriptCG("tests", "rhino_crash2.js");
JSCallGraphBuilderUtil.makeScriptCG("tests", "rhino_crash2.js");
}
@Test

View File

@ -32,7 +32,7 @@ public abstract class TestSimplePageCallGraphShapeRhino extends TestSimplePageCa
@Test public void testPage3() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/page3.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage3);
}
@ -44,7 +44,7 @@ public abstract class TestSimplePageCallGraphShapeRhino extends TestSimplePageCa
@Before
public void setUp() {
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
WebUtil.setFactory(new IHtmlParserFactory() {
public IHtmlParser getParser() {
return TestSimplePageCallGraphShapeRhino.this.getParser();

View File

@ -15,7 +15,7 @@ public class TestSimplePageCallGraphShapeRhinoJericho extends TestSimplePageCall
@Test public void testCrawl() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/crawl.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, null);
}

View File

@ -15,7 +15,7 @@ import com.ibm.wala.cast.js.html.WebUtil;
import com.ibm.wala.cast.js.html.jericho.JerichoHtmlParser;
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
import com.ibm.wala.cast.js.test.Util;
import com.ibm.wala.cast.js.test.JSCallGraphBuilderUtil;
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
import com.ibm.wala.classLoader.SourceFileModule;
import com.ibm.wala.classLoader.SourceModule;
@ -24,7 +24,7 @@ import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.util.CancelException;
public class JsViewerDriver extends Util {
public class JsViewerDriver extends JSCallGraphBuilderUtil {
public static void main(String args[]) throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException {
if (args.length != 1){
@ -36,7 +36,7 @@ public class JsViewerDriver extends Util {
URL url = new URL(args[0]);
// computing CG + PA
Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
JSCallGraphBuilderUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
JavaScriptLoader.addBootstrapFile(WebUtil.preamble);
SourceModule[] sources = getSources(domless, url);

View File

@ -43,10 +43,10 @@ import com.ibm.wala.util.CancelException;
/**
* TODO this class is a mess. rewrite.
*/
public class Util extends com.ibm.wala.cast.js.ipa.callgraph.Util {
public class JSCallGraphBuilderUtil extends com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil {
public static JSCFABuilder makeScriptCGBuilder(String dir, String name, boolean useOneCFA, IRFactory irFactory) throws IOException {
JavaScriptLoaderFactory loaders = Util.makeLoaders();
JavaScriptLoaderFactory loaders = JSCallGraphBuilderUtil.makeLoaders();
AnalysisScope scope = makeScriptScope(dir, name, loaders);
@ -54,9 +54,9 @@ public class Util extends com.ibm.wala.cast.js.ipa.callgraph.Util {
}
static AnalysisScope makeScriptScope(String dir, String name, JavaScriptLoaderFactory loaders) throws IOException {
URL script = Util.class.getClassLoader().getResource(dir + File.separator + name);
URL script = JSCallGraphBuilderUtil.class.getClassLoader().getResource(dir + File.separator + name);
if (script == null) {
script = Util.class.getClassLoader().getResource(dir + "/" + name);
script = JSCallGraphBuilderUtil.class.getClassLoader().getResource(dir + "/" + name);
}
assert script != null : "cannot find " + dir + " and " + name;

View File

@ -31,7 +31,7 @@ public abstract class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
@Test public void testAjaxslt() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xslt.html");
// don't handle call / apply; it makes things blow up
CallGraph CG = Util.makeHTMLCG(url, false);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url, false);
verifyGraphAssertions(CG, assertionsForAjaxslt);
}
@ -42,7 +42,7 @@ public abstract class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
@Test public void testAjaxpath() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xpath.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForAjaxpath);
}

View File

@ -24,26 +24,26 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
@Test public void testPage3WithoutHack() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/page3.html");
JSCFABuilder builder = Util.makeHTMLCGBuilder(url);
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
Util.dumpCG(builder.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(builder.getPointerAnalysis(), CG);
}
@Test public void testPage3WithHack() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/page3.html");
JSCFABuilder builder = Util.makeHTMLCGBuilder(url);
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
addHackedForInLoopSensitivity(builder);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
Util.dumpCG(builder.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(builder.getPointerAnalysis(), CG);
}
@Ignore("This test now blows up due to proper handling of the || construct, used in extend(). Should handle this eventually.")
@Test public void testJQueryWithHack() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/jquery_hacked.html");
JSCFABuilder builder = Util.makeHTMLCGBuilder(url);
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
addHackedForInLoopSensitivity(builder);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
Util.dumpCG(builder.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(builder.getPointerAnalysis(), CG);
}
/*
@ -74,9 +74,9 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
};
@Test public void testBadForInWithoutHack() throws IOException, IllegalArgumentException, CancelException {
JSCFABuilder B = Util.makeScriptCGBuilder("tests", "badforin.js");
JSCFABuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "badforin.js");
CallGraph CG = B.makeCallGraph(B.getOptions());
Util.dumpCG(B.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(B.getPointerAnalysis(), CG);
verifyGraphAssertions(CG, assertionsForBadForin);
}
@ -92,10 +92,10 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
};
@Test public void testBadForInWithHack() throws IOException, IllegalArgumentException, CancelException {
JSCFABuilder B = Util.makeScriptCGBuilder("tests", "badforin.js");
JSCFABuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "badforin.js");
addHackedForInLoopSensitivity(B);
CallGraph CG = B.makeCallGraph(B.getOptions());
Util.dumpCG(B.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(B.getPointerAnalysis(), CG);
verifyGraphAssertions(CG, assertionsForBadForin);
verifyGraphAssertions(CG, assertionsForBadForinHackPrecision);
}
@ -118,9 +118,9 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
};
@Test public void testbadforin2WithoutHack() throws IOException, IllegalArgumentException, CancelException {
JSCFABuilder B = Util.makeScriptCGBuilder("tests", "badforin2.js");
JSCFABuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "badforin2.js");
CallGraph CG = B.makeCallGraph(B.getOptions());
Util.dumpCG(B.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(B.getPointerAnalysis(), CG);
verifyGraphAssertions(CG, assertionsForbadforin2);
}
@ -136,19 +136,19 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
};
@Test public void testbadforin2WithHack() throws IOException, IllegalArgumentException, CancelException {
JSCFABuilder B = Util.makeScriptCGBuilder("tests", "badforin2.js");
JSCFABuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "badforin2.js");
addHackedForInLoopSensitivity(B);
CallGraph CG = B.makeCallGraph(B.getOptions());
Util.dumpCG(B.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(B.getPointerAnalysis(), CG);
verifyGraphAssertions(CG, assertionsForbadforin2);
verifyGraphAssertions(CG, assertionsForbadforin2HackPrecision);
}
@Test public void testForInRecursion() throws IOException, IllegalArgumentException, CancelException {
JSCFABuilder B = Util.makeScriptCGBuilder("tests", "badforin3.js");
JSCFABuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "badforin3.js");
addHackedForInLoopSensitivity(B);
CallGraph CG = B.makeCallGraph(B.getOptions());
Util.dumpCG(B.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(B.getPointerAnalysis(), CG);
}

View File

@ -18,7 +18,7 @@ import com.ibm.wala.ipa.callgraph.CallGraph;
public abstract class TestJSCallGraphShape extends TestCallGraphShape {
protected Collection getNodes(CallGraph CG, String functionIdentifier) {
return Util.getNodes(CG, functionIdentifier);
return JSCallGraphBuilderUtil.getNodes(CG, functionIdentifier);
}
}

View File

@ -30,7 +30,7 @@ public abstract class TestMediawikiCallGraphShape extends TestJSCallGraphShape {
@Test public void testSwineFlu() throws IOException, IllegalArgumentException, CancelException {
URL url = new URL("http://en.wikipedia.org/wiki/2009_swine_flu_outbreak");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForSwineFlu);
}

View File

@ -25,30 +25,30 @@ public abstract class TestMozillaBugPages extends TestJSCallGraphShape {
@Test public void testMozilla439164() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/mochitest/mozillaBug439164.html");
JSCFABuilder builder = Util.makeHTMLCGBuilder(url);
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
Util.dumpCG(builder.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(builder.getPointerAnalysis(), CG);
}
@Test public void testMozilla488233() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/mochitest/mozillaBug488233NoExtJS.html");
JSCFABuilder builder = Util.makeHTMLCGBuilder(url);
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
Util.dumpCG(builder.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(builder.getPointerAnalysis(), CG);
}
@Test public void testMozilla490152() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/mochitest/mozillaBug490152NoExtJS.html");
JSCFABuilder builder = Util.makeHTMLCGBuilder(url);
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
Util.dumpCG(builder.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(builder.getPointerAnalysis(), CG);
}
@Test public void testMozilla625562() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/mochitest/mozillaBug625562NoExtJS.html");
JSCFABuilder builder = Util.makeHTMLCGBuilder(url);
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
Util.dumpCG(builder.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(builder.getPointerAnalysis(), CG);
}
}

View File

@ -68,7 +68,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testSimple() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "simple.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "simple.js");
verifyGraphAssertions(CG, assertionsForSimple);
}
@ -82,7 +82,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testObjects() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "objects.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "objects.js");
verifyGraphAssertions(CG, assertionsForObjects);
}
@ -103,7 +103,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testInherit() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "inherit.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "inherit.js");
verifyGraphAssertions(CG, assertionsForInherit);
}
@ -114,7 +114,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testNewfn() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "newfn.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "newfn.js");
verifyGraphAssertions(CG, assertionsForNewfn);
}
@ -127,7 +127,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testControlflow() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "control-flow.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "control-flow.js");
verifyGraphAssertions(CG, assertionsForControlflow);
}
@ -141,7 +141,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testMoreControlflow() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "more-control-flow.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "more-control-flow.js");
verifyGraphAssertions(CG, assertionsForMoreControlflow);
}
@ -151,7 +151,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testForin() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "forin.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "forin.js");
verifyGraphAssertions(CG, assertionsForForin);
}
@ -169,14 +169,14 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testSimpleLexical() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "simple-lexical.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "simple-lexical.js");
verifyGraphAssertions(CG, assertionsForSimpleLexical);
}
@Test
public void testRecursiveLexical() throws IOException, IllegalArgumentException, CancelException {
// just checking that we have a sufficient bailout to ensure termination
Util.makeScriptCG("tests", "recursive_lexical.js");
JSCallGraphBuilderUtil.makeScriptCG("tests", "recursive_lexical.js");
}
private static final Object[][] assertionsForLexicalMultiple = new Object[][] {
@ -186,7 +186,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testLexicalMultiple() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "lexical_multiple_calls.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "lexical_multiple_calls.js");
verifyGraphAssertions(CG, assertionsForLexicalMultiple);
}
@ -204,7 +204,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testTry() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "try.js", true);
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "try.js", true);
verifyGraphAssertions(CG, assertionsForTry);
}
@ -214,7 +214,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testStringOp() throws IOException, IllegalArgumentException, CancelException {
PropagationCallGraphBuilder B = Util.makeScriptCGBuilder("tests", "string-op.js");
PropagationCallGraphBuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "string-op.js");
B.getOptions().setTraceStringConstants(true);
CallGraph CG = B.makeCallGraph(B.getOptions());
verifyGraphAssertions(CG, assertionsForStringOp);
@ -229,7 +229,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testUpward() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "upward.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "upward.js");
verifyGraphAssertions(CG, assertionsForUpward);
}
@ -239,7 +239,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testStringPrims() throws IOException, IllegalArgumentException, CancelException {
PropagationCallGraphBuilder B = Util.makeScriptCGBuilder("tests", "string-prims.js");
PropagationCallGraphBuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "string-prims.js");
B.getOptions().setTraceStringConstants(true);
CallGraph CG = B.makeCallGraph(B.getOptions());
verifyGraphAssertions(CG, assertionsForStringPrims);
@ -250,7 +250,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testNested() throws IOException, IllegalArgumentException, CancelException {
PropagationCallGraphBuilder B = Util.makeScriptCGBuilder("tests", "nested.js");
PropagationCallGraphBuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "nested.js");
CallGraph CG = B.makeCallGraph(B.getOptions());
verifyGraphAssertions(CG, assertionsForNested);
}
@ -260,7 +260,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testInstanceof() throws IOException, IllegalArgumentException, CancelException {
PropagationCallGraphBuilder B = Util.makeScriptCGBuilder("tests", "instanceof.js");
PropagationCallGraphBuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "instanceof.js");
CallGraph CG = B.makeCallGraph(B.getOptions());
verifyGraphAssertions(CG, assertionsForInstanceof);
}
@ -278,19 +278,19 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testCrash1() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "crash1.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "crash1.js");
verifyGraphAssertions(CG, null);
}
@Test
public void testCrash2() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "crash2.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "crash2.js");
verifyGraphAssertions(CG, null);
}
@Test
public void testLexicalCtor() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "lexical-ctor.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "lexical-ctor.js");
verifyGraphAssertions(CG, null);
}
@ -300,7 +300,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testMultivar() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "multivar.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "multivar.js");
verifyGraphAssertions(CG, assertionsForMultivar);
}
@ -311,7 +311,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testProtoypeContamination() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "prototype_contamination_bug.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "prototype_contamination_bug.js");
verifyGraphAssertions(CG, assertionsForPrototypeContamination);
verifyNoEdges(CG, "suffix:test1", "suffix:foo_of_B");
verifyNoEdges(CG, "suffix:test2", "suffix:foo_of_A");
@ -319,20 +319,20 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testStackOverflowOnSsaConversionBug() throws IOException, IllegalArgumentException, CancelException {
Util.makeScriptCG("tests", "stack_overflow_on_ssa_conversion.js");
JSCallGraphBuilderUtil.makeScriptCG("tests", "stack_overflow_on_ssa_conversion.js");
// all we need is for it to finish building CG successfully.
}
@Test
public void testExtJSSwitch() throws IOException, IllegalArgumentException, CancelException {
Util.makeScriptCG("tests", "extjs_switch.js");
JSCallGraphBuilderUtil.makeScriptCG("tests", "extjs_switch.js");
// all we need is for it to finish building CG successfully.
}
@Test
public void testFunctionDotCall() throws IOException, IllegalArgumentException, CancelException {
CallGraph cg = Util.makeScriptCG("tests", "function_call.js");
CallGraph cg = JSCallGraphBuilderUtil.makeScriptCG("tests", "function_call.js");
for (CGNode n : cg) {
if (n.getMethod().getName().toString().equals("call4")) {
Assert.assertEquals(2, cg.getSuccNodeCount(n));
@ -354,7 +354,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testFunctionDotApply() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "function_apply.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "function_apply.js");
verifyGraphAssertions(CG, assertionsForFunctionApply);
}
@ -364,7 +364,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testFunctionDotApply2() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "function_apply2.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "function_apply2.js");
verifyGraphAssertions(CG, assertionsForFunctionApply2);
}
@ -374,7 +374,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testWrap1() throws IllegalArgumentException, IOException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "wrap1.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "wrap1.js");
verifyGraphAssertions(CG, assertionsForWrap1);
}
@ -384,7 +384,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testWrap2() throws IllegalArgumentException, IOException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "wrap2.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "wrap2.js");
verifyGraphAssertions(CG, assertionsForWrap2);
}
@ -394,7 +394,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testWrap3() throws IllegalArgumentException, IOException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "wrap3.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "wrap3.js");
verifyGraphAssertions(CG, assertionsForWrap3);
}
@ -404,7 +404,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testComplexCall() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "complex_call.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "complex_call.js");
for(CGNode nd : CG)
System.out.println(nd);
verifyGraphAssertions(CG, assertionsForComplexCall);
@ -417,7 +417,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testGlobalObjPassing() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "global_object.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "global_object.js");
verifyGraphAssertions(CG, assertionsForGlobalObj);
}
@ -427,7 +427,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testGlobalObj2() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "global_object2.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "global_object2.js");
verifyGraphAssertions(CG, assertionsForGlobalObj2);
}
@ -439,7 +439,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testReturnThis() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "return_this.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "return_this.js");
verifyGraphAssertions(CG, assertionsForReturnThis);
}
@ -457,7 +457,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testReturnThis2() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "return_this2.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "return_this2.js");
verifyGraphAssertions(CG, assertionsForReturnThis2);
}
@ -469,7 +469,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testArguments() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "arguments.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "arguments.js");
verifyGraphAssertions(CG, assertionsForArguments);
}
@ -479,7 +479,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testFunctionIsAFunction() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "Function_is_a_function.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "Function_is_a_function.js");
verifyGraphAssertions(CG, assertionsForFunctionIsAFunction);
}
@ -491,13 +491,13 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testLexicalBroken() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "lexical_broken.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "lexical_broken.js");
verifyGraphAssertions(CG, assertionsForLexicalBroken);
}
@Test
public void testDeadPhi() throws IllegalArgumentException, IOException, CancelException {
Util.makeScriptCG("tests", "dead_phi.js");
JSCallGraphBuilderUtil.makeScriptCG("tests", "dead_phi.js");
}
private static final Object[][] assertionsForScopingOverwriteFunction = new Object[][] {
@ -507,7 +507,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testScopingOverwriteFunction() throws IllegalArgumentException, IOException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "scoping_test.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "scoping_test.js");
verifyGraphAssertions(CG, assertionsForScopingOverwriteFunction);
}
@ -518,7 +518,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
@Test
public void testNestedAssignToParam() throws IllegalArgumentException, IOException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "nested_assign_to_param.js");
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "nested_assign_to_param.js");
verifyGraphAssertions(CG, assertionsForNestedParamAssign);
}

View File

@ -61,7 +61,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testPage1() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/page1.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage1);
}
@ -72,7 +72,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testPage2() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/page2.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage2);
}
@ -89,7 +89,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testCrawlPage11() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page11.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage11);
}
@ -106,7 +106,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testCrawlPage11b() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page11b.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage11b);
}
@ -138,8 +138,12 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testCrawlPage12() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page12.html");
<<<<<<< HEAD
CallGraph CG = Util.makeHTMLCG(url);
System.err.println(CG);
=======
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
>>>>>>> refactoring: rename some Util classes
verifyGraphAssertions(CG, assertionsForPage12);
}
@ -172,7 +176,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testCrawlPage13() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page13.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage13);
}
@ -190,7 +194,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testCrawlPage15() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page15.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage15);
}
@ -208,7 +212,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testCrawlPage16() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page16.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage16);
}
@ -231,9 +235,13 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testCrawlPage17() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page17.html");
<<<<<<< HEAD
JSCFABuilder builder = Util.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
Util.dumpCG(builder.getPointerAnalysis(), CG);
=======
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
>>>>>>> refactoring: rename some Util classes
verifyGraphAssertions(CG, assertionsForPage17);
}
@ -246,19 +254,19 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testApolloExample() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/apollo-example.html");
CallGraph CG = Util.makeHTMLCG(url);
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForApolloExample);
}
@Test public void testNojs() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/nojs.html");
// all we need is for it to finish building CG successfully.
Util.makeHTMLCG(url);
JSCallGraphBuilderUtil.makeHTMLCG(url);
}
@Test public void testPage4() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/page4.html");
Util.makeHTMLCG(url);
JSCallGraphBuilderUtil.makeHTMLCG(url);
}
private static final Object[][] sourceAssertionsForList = new Object[][] {
@ -273,15 +281,15 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testList() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/list.html");
JSCFABuilder builder = Util.makeHTMLCGBuilder(url);
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
Util.dumpCG(builder.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(builder.getPointerAnalysis(), CG);
verifySourceAssertions(CG, sourceAssertionsForList);
}
@Test public void testIframeTest2() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/iframeTest2.html");
Util.makeHTMLCG(url);
JSCallGraphBuilderUtil.makeHTMLCG(url);
}
private static final Object[][] assertionsForWindowx = new Object[][] {
@ -295,9 +303,9 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
@Test public void testWindowx() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/windowx.html");
JSCFABuilder builder = Util.makeHTMLCGBuilder(url);
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
Util.dumpCG(builder.getPointerAnalysis(), CG);
JSCallGraphBuilderUtil.dumpCG(builder.getPointerAnalysis(), CG);
verifyGraphAssertions(CG, assertionsForWindowx);
}

View File

@ -50,7 +50,7 @@ import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeName;
import com.ibm.wala.types.TypeReference;
public class Util extends com.ibm.wala.cast.ipa.callgraph.Util {
public class JSCallGraphUtil extends com.ibm.wala.cast.ipa.callgraph.CAstCallGraphUtil {
private static final boolean DEBUG = false;
@ -70,7 +70,7 @@ public class Util extends com.ibm.wala.cast.ipa.callgraph.Util {
* {@link #makeLoaders()}.
*/
public static void setTranslatorFactory(JavaScriptTranslatorFactory translatorFactory) {
Util.translatorFactory = translatorFactory;
JSCallGraphUtil.translatorFactory = translatorFactory;
}
public static JavaScriptTranslatorFactory getTranslatorFactory() {
@ -78,7 +78,7 @@ public class Util extends com.ibm.wala.cast.ipa.callgraph.Util {
}
public static void setPreprocessor(CAstRewriterFactory preprocessor) {
Util.preprocessor = preprocessor;
JSCallGraphUtil.preprocessor = preprocessor;
}
public static JSAnalysisOptions makeOptions(AnalysisScope scope, IClassHierarchy cha, Iterable<Entrypoint> roots) {

View File

@ -430,7 +430,7 @@ public class JavaScriptConstructTargetSelector implements MethodTargetSelector {
FO.write(fun.toString());
FO.close();
Set<String> fnNames = Util.loadAdditionalFile(cha, cl, fileName, f.toURI().toURL(), f.getAbsolutePath());
Set<String> fnNames = JSCallGraphUtil.loadAdditionalFile(cha, cl, fileName, f.toURI().toURL(), f.getAbsolutePath());
IClass fcls = null;
for(String nm : fnNames) {
if (nm.endsWith("_fromctor")) {

View File

@ -173,7 +173,7 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
private String getKey(int nargs, CGNode caller, CallSiteReference site) {
if (SEPARATE_SYNTHETIC_METHOD_PER_SITE) {
return Util.getShortName(caller) + "_" + caller.getGraphNodeId() + "_" + site.getProgramCounter();
return JSCallGraphUtil.getShortName(caller) + "_" + caller.getGraphNodeId() + "_" + site.getProgramCounter();
} else {
return ""+nargs;
}

View File

@ -60,7 +60,7 @@ public class LoadFileTargetSelector implements MethodTargetSelector {
JavaScriptLoader cl = (JavaScriptLoader) builder.getClassHierarchy().getLoader(JavaScriptTypes.jsLoader);
URL url = new URL(builder.getBaseURL(), str);
if(!loadedFiles.contains(url)) {
Util.loadAdditionalFile(builder.getClassHierarchy() , cl, str, url, url.getFile());
JSCallGraphUtil.loadAdditionalFile(builder.getClassHierarchy() , cl, str, url, url.getFile());
loadedFiles.add(url);
IClass script = builder.getClassHierarchy().lookupClass(TypeReference.findOrCreate(cl.getReference(), "L" + url.getFile()));
return script.getMethod(JavaScriptMethods.fnSelector);

View File

@ -10,7 +10,7 @@ import java.util.Set;
import junit.framework.Assert;
import com.ibm.wala.cast.ipa.callgraph.Util;
import com.ibm.wala.cast.ipa.callgraph.CAstCallGraphUtil;
import com.ibm.wala.cast.ir.ssa.AstIRFactory;
import com.ibm.wala.cast.loader.SingleClassLoaderFactory;
import com.ibm.wala.classLoader.IClass;
@ -119,7 +119,7 @@ public abstract class TestCAstTranslator extends WalaTestCase {
public ClassHierarchy runTranslator(SourceFileModule[] fileNames) throws Exception {
SingleClassLoaderFactory loaders = getClassLoaderFactory();
AnalysisScope scope = Util.makeScope(fileNames, loaders, getLanguage());
AnalysisScope scope = CAstCallGraphUtil.makeScope(fileNames, loaders, getLanguage());
ClassHierarchy cha = ClassHierarchy.make(scope, loaders, getLanguage());
@ -208,12 +208,12 @@ public abstract class TestCAstTranslator extends WalaTestCase {
SourceFileModule[] fileNames = new SourceFileModule[args.length];
for (int i = 0; i < args.length; i++) {
if (new File(args[i]).exists()) {
fileNames[i] = Util.makeSourceModule(new File(args[i]).toURI().toURL(), args[i]);
fileNames[i] = CAstCallGraphUtil.makeSourceModule(new File(args[i]).toURI().toURL(), args[i]);
} else if (new File(testPath + args[i]).exists()) {
fileNames[i] = Util.makeSourceModule(new File(testPath + args[i]).toURI().toURL(), args[i]);
fileNames[i] = CAstCallGraphUtil.makeSourceModule(new File(testPath + args[i]).toURI().toURL(), args[i]);
} else {
URL url = getClass().getClassLoader().getResource(args[i]);
fileNames[i] = Util.makeSourceModule(url, args[i]);
fileNames[i] = CAstCallGraphUtil.makeSourceModule(url, args[i]);
}
Assert.assertTrue(args[i], fileNames[i] != null);
}

View File

@ -32,7 +32,7 @@ import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.IRFactory;
import com.ibm.wala.util.debug.Assertions;
public class Util {
public class CAstCallGraphUtil {
/**
* flag to prevent dumping of verbose call graph / pointer analysis output
@ -144,13 +144,13 @@ public class Util {
for (int i = 0; i < fileNameArgs.length; i++) {
if (new File(fileNameArgs[i]).exists()) {
try {
fileNames[i] = Util.makeSourceModule(new File(fileNameArgs[i]).toURI().toURL(), fileNameArgs[i]);
fileNames[i] = CAstCallGraphUtil.makeSourceModule(new File(fileNameArgs[i]).toURI().toURL(), fileNameArgs[i]);
} catch (MalformedURLException e) {
Assertions.UNREACHABLE(e.toString());
}
} else {
URL url = Util.class.getClassLoader().getResource(fileNameArgs[i]);
fileNames[i] = Util.makeSourceModule(url, fileNameArgs[i]);
URL url = CAstCallGraphUtil.class.getClassLoader().getResource(fileNameArgs[i]);
fileNames[i] = CAstCallGraphUtil.makeSourceModule(url, fileNameArgs[i]);
}
}