static <I extends InstanceKey> AbstractAnalysisEngine<I, CallGraphBuilder<I>, ?> makeAnalysisEngine(final String[] mainClassDescriptors, ZippedProjectData project) { AbstractAnalysisEngine<I, CallGraphBuilder<I>, ?> engine; engine = new JDTJavaSourceAnalysisEngine<I>(project.projectName) { { setDump(Boolean.parseBoolean(System.getProperty("wala.cast.dump", "false"))); } @Override protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope, IClassHierarchy cha) { return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE, cha, mainClassDescriptors); } }; try { File tf = TemporaryFile.urlToFile("exclusions.txt", CallGraphTestUtil.class.getClassLoader().getResource(CallGraphTestUtil.REGRESSION_EXCLUSIONS)); engine.setExclusionsFile(tf.getAbsolutePath()); tf.deleteOnExit(); } catch (IOException e) { Assert.assertFalse("Cannot find exclusions file: " + e.toString(), true); } return engine; }
public <I extends InstanceKey> Pair<CallGraph, PointerAnalysis<? extends InstanceKey>> runTest(Collection<String> sources, List<String> libs, String[] mainClassDescriptors, List<? extends IRAssertion> ca, boolean assertReachable, String exclusionsFile) throws IllegalArgumentException, CancelException, IOException { AbstractAnalysisEngine<I, CallGraphBuilder<I>, ?> engine = getAnalysisEngine(mainClassDescriptors, sources, libs); if (exclusionsFile != null) { engine.setExclusionsFile(exclusionsFile); } CallGraph callGraph; callGraph = engine.buildDefaultCallGraph(); //System.err.println(callGraph.toString()); // If we've gotten this far, IR has been produced. if (dump) { dumpIR(callGraph, sources, assertReachable); } // Now check any assertions as to source mapping for (IRAssertion IRAssertion : ca) { IRAssertion.check(callGraph); } return Pair.make(callGraph, engine.getPointerAnalysis()); }