Remove "throws XYZ" declarations where XYZ cannot be thrown

Unnecessary "throws" declarations tend to cascade.  If foo() calls
bar() and bar() falsely declares that it might throw IOException, that
often leads a programmer to declare that foo() might throw IOException
as well.  Fixing the bar() throws declaration then reveals that we can
fix the foo() throws declaration too.  By the time we reach a fixed
point with cleaning these up, we have removed roughly 320 unnecessary
throws declarations.

In a few cases, this cleanup even lets us remove entire "try
... catch" statements where the only thing being caught was an
exception that we now statically know cannot be thrown.  Nice!

In Eclipse project configurations, upgrade any future such shenanigans
from warnings to errors.  Now that we've fixed this, we don't want it
coming back again.

There is a potential drawback to this change.  Conceivably some public
WALA API entry point might have declared that it could throw some
exception merely to reserve the *option* of throwing that exception in
third-party code that subclasses and overrides the API entry point in
question.  I have no idea whether this is a significant concern in
practice, though.
This commit is contained in:
Ben Liblit 2017-07-27 16:53:07 -05:00 committed by Manu Sridharan
parent c1572ec3a5
commit 191904d607
93 changed files with 246 additions and 356 deletions

View File

@ -32,8 +32,7 @@ public class ECJClassLoaderFactory extends ClassLoaderFactoryImpl {
}
}
protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent)
throws IOException {
protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent) {
return new ECJSourceLoaderImpl(classLoaderReference, parent, getExclusions(), cha, false);
}

View File

@ -37,8 +37,6 @@
*/
package com.ibm.wala.cast.java.translator.jdt.ecj;
import java.io.IOException;
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
import com.ibm.wala.cast.java.translator.SourceModuleTranslator;
import com.ibm.wala.classLoader.IClassLoader;
@ -49,11 +47,11 @@ import com.ibm.wala.util.config.SetOfClasses;
public class ECJSourceLoaderImpl extends JavaSourceLoaderImpl {
private final boolean dump;
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) throws IOException {
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) {
this(loaderRef, parent, exclusions, cha, false);
}
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha, boolean dump) throws IOException {
public ECJSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha, boolean dump) {
super(loaderRef, parent, exclusions, cha);
this.dump = dump;
}

View File

@ -102,7 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -369,7 +369,7 @@ public abstract class IRTests {
return Pair.make(callGraph, engine.getPointerAnalysis());
}
protected static void dumpIR(CallGraph cg, Collection<String> sources, boolean assertReachable) throws IOException {
protected static void dumpIR(CallGraph cg, Collection<String> sources, boolean assertReachable) {
Set<String> sourcePaths = HashSetFactory.make();
for(String src : sources) {
sourcePaths.add(src.substring(src.lastIndexOf(File.separator)+1));

View File

@ -102,7 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -483,12 +483,12 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
/** BEGIN Custom change: Common superclass is optional */
public JavaSourceLoaderImpl(boolean existsCommonSuperClass, ClassLoaderReference loaderRef, IClassLoader parent,
SetOfClasses exclusions, IClassHierarchy cha) throws IOException {
SetOfClasses exclusions, IClassHierarchy cha) {
super(loaderRef, cha.getScope().getArrayClassLoader(), parent, cha.getScope().getExclusions(), cha);
this.existsCommonSuperclass = existsCommonSuperClass;
}
public JavaSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) throws IOException {
public JavaSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) {
// standard case: we have a common super class
this(true, loaderRef, parent, exclusions, cha);
}

View File

@ -102,7 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -43,7 +43,6 @@ import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ssa.IRFactory;
import com.ibm.wala.util.CancelException;
import com.ibm.wala.util.WalaException;
/**
@ -52,12 +51,12 @@ import com.ibm.wala.util.WalaException;
public class NodejsCallGraphBuilderUtil extends JSCallGraphUtil {
public static PropagationCallGraphBuilder makeCGBuilder(File mainFile)
throws IOException, IllegalArgumentException, CancelException, WalaException {
throws IOException, IllegalArgumentException, WalaException {
return makeCGBuilder(mainFile.getParentFile(), mainFile);
}
public static PropagationCallGraphBuilder makeCGBuilder(File workingDir, File mainFile)
throws IOException, IllegalArgumentException, CancelException, WalaException {
throws IOException, IllegalArgumentException, WalaException {
JavaScriptTranslatorFactory translatorFactory = new CAstRhinoTranslatorFactory();
JSCallGraphUtil.setTranslatorFactory(translatorFactory);

View File

@ -102,7 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -1,6 +1,5 @@
package com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test;
import java.io.IOException;
import java.net.URL;
import java.util.Map;
import java.util.Set;
@ -34,11 +33,11 @@ public abstract class AbstractFieldBasedTest extends TestJSCallGraphShape {
util = new FieldBasedCGUtil(new CAstRhinoTranslatorFactory());
}
protected JSCallGraph runTest(String script, Object[][] assertions, BuilderType... builderTypes) throws IOException, WalaException, Error, CancelException {
protected JSCallGraph runTest(String script, Object[][] assertions, BuilderType... builderTypes) throws WalaException, Error, CancelException {
return runTest(TestFieldBasedCG.class.getClassLoader().getResource(script), assertions, builderTypes);
}
protected JSCallGraph runTest(URL url, Object[][] assertions, BuilderType... builderTypes) throws IOException, WalaException, Error, CancelException {
protected JSCallGraph runTest(URL url, Object[][] assertions, BuilderType... builderTypes) throws WalaException, Error, CancelException {
JSCallGraph cg = null;
for(BuilderType builderType : builderTypes) {
ProgressMaster monitor = ProgressMaster.make(new NullProgressMonitor(), 45000, true);
@ -56,7 +55,7 @@ public abstract class AbstractFieldBasedTest extends TestJSCallGraphShape {
/**
* for long-running tests that tend to time out on Travis
*/
protected JSCallGraph runTestExceptOnTravis(URL url, Object[][] assertions, BuilderType... builderTypes) throws IOException, WalaException, Error, CancelException {
protected JSCallGraph runTestExceptOnTravis(URL url, Object[][] assertions, BuilderType... builderTypes) throws WalaException, Error, CancelException {
if (System.getenv("TRAVIS") == null) {
return runTest(url, assertions, builderTypes);
} else {

View File

@ -1,7 +1,5 @@
package com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test;
import java.io.IOException;
import org.junit.Test;
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error;
@ -13,7 +11,7 @@ import com.ibm.wala.util.WalaException;
public class FieldBasedComparisonTest extends AbstractFieldBasedTest {
private void test(String file, Object[][] assertions, BuilderType builderType) throws IOException, WalaException, Error, CancelException {
private void test(String file, Object[][] assertions, BuilderType builderType) throws WalaException, Error, CancelException {
boolean save = JSSourceExtractor.USE_TEMP_NAME;
try {
JSSourceExtractor.USE_TEMP_NAME = false;
@ -24,32 +22,32 @@ public class FieldBasedComparisonTest extends AbstractFieldBasedTest {
}
@Test(expected = AssertionError.class)
public void testSkeletonPessimistic() throws IOException, WalaException, Error, CancelException {
public void testSkeletonPessimistic() throws WalaException, Error, CancelException {
test("pages/skeleton.html", TestSimplePageCallGraphShape.assertionsForSkeleton, BuilderType.PESSIMISTIC);
}
@Test
public void testSkeletonOptimistic() throws IOException, WalaException, Error, CancelException {
public void testSkeletonOptimistic() throws WalaException, Error, CancelException {
test("pages/skeleton.html", TestSimplePageCallGraphShape.assertionsForSkeleton, BuilderType.OPTIMISTIC);
}
@Test
public void testSkeletonWorklist() throws IOException, WalaException, Error, CancelException {
public void testSkeletonWorklist() throws WalaException, Error, CancelException {
test("pages/skeleton.html", TestSimplePageCallGraphShape.assertionsForSkeleton, BuilderType.OPTIMISTIC_WORKLIST);
}
@Test(expected = AssertionError.class)
public void testSkeleton2Pessimistic() throws IOException, WalaException, Error, CancelException {
public void testSkeleton2Pessimistic() throws WalaException, Error, CancelException {
test("pages/skeleton2.html", TestSimplePageCallGraphShape.assertionsForSkeleton2, BuilderType.PESSIMISTIC);
}
@Test
public void testSkeleton2Optimistic() throws IOException, WalaException, Error, CancelException {
public void testSkeleton2Optimistic() throws WalaException, Error, CancelException {
test("pages/skeleton2.html", TestSimplePageCallGraphShape.assertionsForSkeleton2, BuilderType.OPTIMISTIC);
}
@Test
public void testSkeleton2Worklist() throws IOException, WalaException, Error, CancelException {
public void testSkeleton2Worklist() throws WalaException, Error, CancelException {
test("pages/skeleton2.html", TestSimplePageCallGraphShape.assertionsForSkeleton2, BuilderType.OPTIMISTIC_WORKLIST);
}

View File

@ -10,8 +10,6 @@
*****************************************************************************/
package com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test;
import java.io.IOException;
import org.junit.Test;
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error;
@ -28,17 +26,17 @@ public class TestFieldBasedCG extends AbstractFieldBasedTest {
};
@Test
public void testSimpleJSPessimistic() throws IOException, WalaException, Error, CancelException {
public void testSimpleJSPessimistic() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/simple.js", assertionsForSimpleJS, BuilderType.PESSIMISTIC);
}
@Test
public void testSimpleJSOptimistic() throws IOException, WalaException, Error, CancelException {
public void testSimpleJSOptimistic() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/simple.js", assertionsForSimpleJS, BuilderType.OPTIMISTIC);
}
@Test
public void testSimpleJSWorklist() throws IOException, WalaException, Error, CancelException {
public void testSimpleJSWorklist() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/simple.js", assertionsForSimpleJS, BuilderType.OPTIMISTIC_WORKLIST);
}
@ -49,17 +47,17 @@ public class TestFieldBasedCG extends AbstractFieldBasedTest {
};
@Test
public void testOneshotPessimistic() throws IOException, WalaException, Error, CancelException {
public void testOneshotPessimistic() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/oneshot.js", assertionsForOneShot, BuilderType.PESSIMISTIC);
}
@Test
public void testOneshotOptimistic() throws IOException, WalaException, Error, CancelException {
public void testOneshotOptimistic() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/oneshot.js", assertionsForOneShot, BuilderType.OPTIMISTIC);
}
@Test
public void testOneshotWorklist() throws IOException, WalaException, Error, CancelException {
public void testOneshotWorklist() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/oneshot.js", assertionsForOneShot, BuilderType.OPTIMISTIC_WORKLIST);
}
@ -71,12 +69,12 @@ public class TestFieldBasedCG extends AbstractFieldBasedTest {
};
@Test
public void testCallbacksOptimistic() throws IOException, WalaException, Error, CancelException {
public void testCallbacksOptimistic() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/callbacks.js", assertionsForCallbacks, BuilderType.OPTIMISTIC_WORKLIST);
}
@Test
public void testCallbacksWorklist() throws IOException, WalaException, Error, CancelException {
public void testCallbacksWorklist() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/callbacks.js", assertionsForCallbacks, BuilderType.OPTIMISTIC_WORKLIST);
}
@ -85,17 +83,17 @@ public class TestFieldBasedCG extends AbstractFieldBasedTest {
};
@Test
public void testLexicalPessimistic() throws IOException, WalaException, Error, CancelException {
public void testLexicalPessimistic() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/lexical.js", assertionsForLexical, BuilderType.PESSIMISTIC);
}
@Test
public void testLexicalOptimistic() throws IOException, WalaException, Error, CancelException {
public void testLexicalOptimistic() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/lexical.js", assertionsForLexical, BuilderType.OPTIMISTIC);
}
@Test
public void testLexicalWorklist() throws IOException, WalaException, Error, CancelException {
public void testLexicalWorklist() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/lexical.js", assertionsForLexical, BuilderType.OPTIMISTIC_WORKLIST);
}
@ -107,12 +105,12 @@ public class TestFieldBasedCG extends AbstractFieldBasedTest {
};
@Test
public void testReflectiveCallOptimistic() throws IOException, WalaException, Error, CancelException {
public void testReflectiveCallOptimistic() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/reflective_calls.js", assertionsForReflectiveCall, BuilderType.OPTIMISTIC);
}
@Test
public void testReflectiveCallWorklist() throws IOException, WalaException, Error, CancelException {
public void testReflectiveCallWorklist() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/reflective_calls.js", assertionsForReflectiveCall, BuilderType.OPTIMISTIC_WORKLIST);
}
@ -122,12 +120,12 @@ public class TestFieldBasedCG extends AbstractFieldBasedTest {
};
@Test
public void testNewOptimistic() throws IOException, WalaException, Error, CancelException {
public void testNewOptimistic() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/new.js", assertionsForNew, BuilderType.OPTIMISTIC);
}
@Test
public void testNewWorklist() throws IOException, WalaException, Error, CancelException {
public void testNewWorklist() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/new.js", assertionsForNew, BuilderType.OPTIMISTIC_WORKLIST);
}
@ -137,17 +135,17 @@ public class TestFieldBasedCG extends AbstractFieldBasedTest {
};
@Test
public void testCallbacks2Optimistic() throws IOException, WalaException, Error, CancelException {
public void testCallbacks2Optimistic() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/callbacks2.js", assertionsForCallbacks2, BuilderType.OPTIMISTIC);
}
@Test
public void testCallbacks2Worklist() throws IOException, WalaException, Error, CancelException {
public void testCallbacks2Worklist() throws WalaException, Error, CancelException {
runTest("tests/fieldbased/callbacks2.js", assertionsForCallbacks2, BuilderType.OPTIMISTIC_WORKLIST);
}
// @Test
public void testBug2979() throws IOException, WalaException, Error, CancelException {
public void testBug2979() throws WalaException, Error, CancelException {
System.err.println(runTest("pages/2979.html", new Object[][]{}, BuilderType.PESSIMISTIC, BuilderType.OPTIMISTIC, BuilderType.OPTIMISTIC_WORKLIST));
}

View File

@ -90,7 +90,7 @@ public class PrintIRs {
}
private static void printIRsForHTML(String filename) throws IllegalArgumentException, MalformedURLException, IOException,
CancelException, WalaException, Error {
WalaException, Error {
// use Rhino to parse JavaScript
JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
// add model for DOM APIs

View File

@ -31,7 +31,6 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.util.CancelException;
import com.ibm.wala.util.collections.HashMapFactory;
public class TestRhinoSourceMap {
@ -149,7 +148,7 @@ public class TestRhinoSourceMap {
};
@Test
public void testJquerySpecTestSourceMappings() throws IllegalArgumentException, IOException, CancelException, ClassHierarchyException {
public void testJquerySpecTestSourceMappings() throws IllegalArgumentException, IOException, ClassHierarchyException {
checkFunctionBodies("jquery_spec_test.js", jquery_spec_testSource);
}

View File

@ -10,7 +10,6 @@
*****************************************************************************/
package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import org.junit.Before;
@ -35,14 +34,14 @@ public abstract class TestSimplePageCallGraphShapeRhino extends TestSimplePageCa
new Object[] { "page3.html", new String[] { "page3.html/__WINDOW_MAIN__" } }
};
@Test public void testPage3() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testPage3() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/page3.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url, DefaultSourceExtractor.factory);
verifyGraphAssertions(CG, assertionsForPage3);
}
@Test(expected = WalaException.class)
public void testJSParseError() throws IOException, IllegalArgumentException, CancelException, WalaException {
public void testJSParseError() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/garbage2.html");
JSCFABuilder B = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url, DefaultSourceExtractor.factory);
B.makeCallGraph(B.getOptions());

View File

@ -10,7 +10,6 @@
*******************************************************************************/
package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import org.junit.Test;
@ -27,13 +26,13 @@ import com.ibm.wala.util.WalaException;
public class TestSimplePageCallGraphShapeRhinoJericho extends TestSimplePageCallGraphShapeRhino {
@Test public void testCrawl() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testCrawl() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/crawl.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url, DefaultSourceExtractor.factory);
verifyGraphAssertions(CG, null);
}
@Test public void testParseError() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testParseError() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/garbage.html");
JSCFABuilder B = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url, DefaultSourceExtractor.factory);
B.makeCallGraph(B.getOptions());

View File

@ -101,7 +101,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -62,11 +62,11 @@ public class FieldBasedCGUtil {
this.translatorFactory = translatorFactory;
}
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildCG(URL url, BuilderType builderType, boolean supportFullPointerAnalysis, Function<Void, JSSourceExtractor> fExtractor) throws IOException, WalaException, CancelException {
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildCG(URL url, BuilderType builderType, boolean supportFullPointerAnalysis, Function<Void, JSSourceExtractor> fExtractor) throws WalaException, CancelException {
return buildCG(url, builderType, new NullProgressMonitor(), supportFullPointerAnalysis, fExtractor);
}
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis, Function<Void, JSSourceExtractor> fExtractor) throws IOException, WalaException, CancelException {
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis, Function<Void, JSSourceExtractor> fExtractor) throws WalaException, CancelException {
if (url.getFile().endsWith(".js")) {
return buildScriptCG(url, builderType, monitor, supportFullPointerAnalysis);
} else {
@ -74,7 +74,7 @@ public class FieldBasedCGUtil {
}
}
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildScriptCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws IOException, WalaException, CancelException {
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildScriptCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws WalaException, CancelException {
JavaScriptLoaderFactory loaders = new JavaScriptLoaderFactory(translatorFactory);
Module[] scripts = new Module[]{
new SourceURLModule(url),
@ -89,13 +89,13 @@ public class FieldBasedCGUtil {
return buildCG(loaders, scripts, builderType, monitor, supportFullPointerAnalysis);
}
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildPageCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis, Function<Void, JSSourceExtractor> fExtractor) throws IOException, WalaException, CancelException {
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildPageCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis, Function<Void, JSSourceExtractor> fExtractor) throws WalaException, CancelException {
JavaScriptLoaderFactory loaders = new WebPageLoaderFactory(translatorFactory);
SourceModule[] scripts = JSCallGraphBuilderUtil.makeHtmlScope(url, loaders, fExtractor);
return buildCG(loaders, scripts, builderType, monitor, supportFullPointerAnalysis);
}
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildCG(JavaScriptLoaderFactory loaders, Module[] scripts, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws IOException, WalaException, CancelException {
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildCG(JavaScriptLoaderFactory loaders, Module[] scripts, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws WalaException, CancelException {
CAstAnalysisScope scope = new CAstAnalysisScope(scripts, loaders, Collections.singleton(JavaScriptLoader.JS));
IClassHierarchy cha = ClassHierarchyFactory.make(scope, loaders, JavaScriptLoader.JS);
Util.checkForFrontEndErrors(cha);

View File

@ -161,7 +161,7 @@ public class JSCallGraphBuilderUtil extends com.ibm.wala.cast.js.ipa.callgraph.J
return CG;
}
public static CallGraph makeScriptCG(SourceModule[] scripts, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IOException, IllegalArgumentException,
public static CallGraph makeScriptCG(SourceModule[] scripts, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IllegalArgumentException,
CancelException, WalaException {
CAstRewriterFactory<?, ?> preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, scripts) : null;
PropagationCallGraphBuilder b = makeCGBuilder(makeLoaders(preprocessor), scripts, builderType, irFactory);
@ -170,11 +170,11 @@ public class JSCallGraphBuilderUtil extends com.ibm.wala.cast.js.ipa.callgraph.J
return CG;
}
public static JSCFABuilder makeHTMLCGBuilder(URL url, Function<Void, JSSourceExtractor> fExtractor) throws IOException, WalaException {
public static JSCFABuilder makeHTMLCGBuilder(URL url, Function<Void, JSSourceExtractor> fExtractor) throws WalaException {
return makeHTMLCGBuilder(url, CGBuilderType.ZERO_ONE_CFA, fExtractor);
}
public static JSCFABuilder makeHTMLCGBuilder(URL url, CGBuilderType builderType, Function<Void, JSSourceExtractor> fExtractor) throws IOException, WalaException {
public static JSCFABuilder makeHTMLCGBuilder(URL url, CGBuilderType builderType, Function<Void, JSSourceExtractor> fExtractor) throws WalaException {
IRFactory<IMethod> irFactory = AstIRFactory.makeDefaultFactory();
CAstRewriterFactory<?, ?> preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, url) : null;
JavaScriptLoaderFactory loaders = new WebPageLoaderFactory(translatorFactory, preprocessor);
@ -206,26 +206,26 @@ public class JSCallGraphBuilderUtil extends com.ibm.wala.cast.js.ipa.callgraph.J
return scriptsArray;
}
public static CallGraph makeHTMLCG(URL url, Function<Void, JSSourceExtractor> fExtractor) throws IOException, IllegalArgumentException, CancelException, WalaException {
public static CallGraph makeHTMLCG(URL url, Function<Void, JSSourceExtractor> fExtractor) throws IllegalArgumentException, CancelException, WalaException {
SSAPropagationCallGraphBuilder b = makeHTMLCGBuilder(url, fExtractor);
CallGraph CG = b.makeCallGraph(b.getOptions());
dumpCG(b.getCFAContextInterpreter(), b.getPointerAnalysis(), CG);
return CG;
}
public static CallGraph makeHTMLCG(URL url, CGBuilderType builderType, Function<Void, JSSourceExtractor> fExtractor) throws IOException, IllegalArgumentException,
public static CallGraph makeHTMLCG(URL url, CGBuilderType builderType, Function<Void, JSSourceExtractor> fExtractor) throws IllegalArgumentException,
CancelException, WalaException {
PropagationCallGraphBuilder b = makeHTMLCGBuilder(url, builderType, fExtractor);
CallGraph CG = b.makeCallGraph(b.getOptions());
return CG;
}
public static JSCFABuilder makeCGBuilder(JavaScriptLoaderFactory loaders, SourceModule[] scripts, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IOException, WalaException {
public static JSCFABuilder makeCGBuilder(JavaScriptLoaderFactory loaders, SourceModule[] scripts, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws WalaException {
AnalysisScope scope = makeScope(scripts, loaders, JavaScriptLoader.JS);
return makeCG(loaders, scope, builderType, irFactory);
}
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IOException, WalaException {
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws WalaException {
try {
IClassHierarchy cha = makeHierarchy(scope, loaders);
com.ibm.wala.cast.js.util.Util.checkForFrontEndErrors(cha);
@ -245,15 +245,15 @@ public class JSCallGraphBuilderUtil extends com.ibm.wala.cast.js.ipa.callgraph.J
}
}
public static CallGraph makeHTMLCG(URL url, CGBuilderType zeroOneCfaNoCallApply) throws IllegalArgumentException, IOException, CancelException, WalaException {
public static CallGraph makeHTMLCG(URL url, CGBuilderType zeroOneCfaNoCallApply) throws IllegalArgumentException, CancelException, WalaException {
return makeHTMLCG(url, zeroOneCfaNoCallApply, DefaultSourceExtractor.factory);
}
public static CallGraph makeHTMLCG(URL url) throws IllegalArgumentException, IOException, CancelException, WalaException {
public static CallGraph makeHTMLCG(URL url) throws IllegalArgumentException, CancelException, WalaException {
return makeHTMLCG(url, DefaultSourceExtractor.factory);
}
public static JSCFABuilder makeHTMLCGBuilder(URL url) throws IOException, WalaException {
public static JSCFABuilder makeHTMLCGBuilder(URL url) throws WalaException {
return makeHTMLCGBuilder(url, DefaultSourceExtractor.factory);
}
}

View File

@ -10,7 +10,6 @@
*****************************************************************************/
package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import org.junit.Test;
@ -30,7 +29,7 @@ public abstract class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
};
@Test public void testAjaxslt() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testAjaxslt() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xslt.html");
// need to turn off call/apply handling for this to scale; alternatively use 1-CFA
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url, CGBuilderType.ZERO_ONE_CFA_NO_CALL_APPLY);
@ -42,7 +41,7 @@ public abstract class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
};
@Test public void testAjaxpath() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testAjaxpath() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xpath.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForAjaxpath);

View File

@ -34,14 +34,14 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
JSSourceExtractor.DELETE_UPON_EXIT = false;
}
@Test public void testPage3WithoutHack() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testPage3WithoutHack() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/page3.html");
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
CAstCallGraphUtil.dumpCG(builder.getCFAContextInterpreter(), builder.getPointerAnalysis(), CG);
}
@Test public void testPage3WithHack() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testPage3WithHack() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/page3.html");
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
addHackedForInLoopSensitivity(builder);
@ -50,7 +50,7 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
}
@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, WalaException {
@Test public void testJQueryWithHack() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/jquery_hacked.html");
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
addHackedForInLoopSensitivity(builder);

View File

@ -10,7 +10,6 @@
*******************************************************************************/
package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import org.junit.Before;
@ -37,7 +36,7 @@ public class TestJQueryExamples extends TestJSCallGraphShape {
}
@Ignore("This tries to analyze unmodified jquery, which we can't do yet")
@Test public void testEx1() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testEx1() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/jquery/ex1.html");
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());

View File

@ -162,7 +162,7 @@ public abstract class TestPointerAnalyses {
return false;
}
private void testPage(URL page, Predicate<MethodReference> filter, Predicate<Pair<Set<Pair<CGNode, NewSiteReference>>, Set<Pair<CGNode, NewSiteReference>>>> test) throws IOException, WalaException, CancelException {
private void testPage(URL page, Predicate<MethodReference> filter, Predicate<Pair<Set<Pair<CGNode, NewSiteReference>>, Set<Pair<CGNode, NewSiteReference>>>> test) throws WalaException, CancelException {
boolean save = JSSourceExtractor.USE_TEMP_NAME;
try {
JSSourceExtractor.USE_TEMP_NAME = false;
@ -366,7 +366,7 @@ public abstract class TestPointerAnalyses {
}, node, vn);
}
private void testPageUserCodeEquivalent(URL page) throws IOException, WalaException, CancelException {
private void testPageUserCodeEquivalent(URL page) throws WalaException, CancelException {
final String name = page.getFile().substring(page.getFile().lastIndexOf('/')+1, page.getFile().lastIndexOf('.'));
testPage(page, nameFilter(name), new CheckPointers());
}
@ -383,7 +383,7 @@ public abstract class TestPointerAnalyses {
}
@Test
public void testWindowOnload() throws IOException, WalaException, CancelException {
public void testWindowOnload() throws WalaException, CancelException {
testPageUserCodeEquivalent(getClass().getClassLoader().getResource("pages/windowonload.html"));
}

View File

@ -10,7 +10,6 @@
*****************************************************************************/
package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import org.junit.Ignore;
@ -32,7 +31,7 @@ public abstract class TestPrototypeCallGraphShape extends TestJSCallGraphShape {
@Ignore("reminder that this no longer works with correlation tracking")
@Test
public void testPrototype() throws IOException, IllegalArgumentException, CancelException, WalaException {
public void testPrototype() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/prototype.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPrototype);

View File

@ -10,7 +10,6 @@
*****************************************************************************/
package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import org.junit.Before;
@ -50,7 +49,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
}
};
@Test public void testPage1() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testPage1() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/page1.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage1);
@ -61,7 +60,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
new Object[] { "page2.html", new String[] { "page2.html/__WINDOW_MAIN__" } }
};
@Test public void testPage2() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testPage2() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/page2.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage2);
@ -78,7 +77,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
}
};
@Test public void testCrawlPage11() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testCrawlPage11() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page11.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage11);
@ -95,7 +94,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
}
};
@Test public void testCrawlPage11b() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testCrawlPage11b() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page11b.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage11b);
@ -127,7 +126,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
},
};
@Test public void testCrawlPage12() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testCrawlPage12() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page12.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage12);
@ -160,7 +159,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
}
};
@Test public void testCrawlPage13() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testCrawlPage13() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page13.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage13);
@ -178,7 +177,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
}
};
@Test public void testCrawlPage15() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testCrawlPage15() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page15.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage15);
@ -196,7 +195,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
}
};
@Test public void testCrawlPage16() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testCrawlPage16() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page16.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage16);
@ -219,7 +218,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
}
};
@Test public void testCrawlPage17() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testCrawlPage17() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/crawl/page17.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage17);
@ -232,19 +231,19 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
new Object[] { "apollo-example.html/__WINDOW_MAIN__/signon", new String[] { "preamble.js/DOMWindow/window_open" } }
};
@Test public void testApolloExample() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testApolloExample() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/apollo-example.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForApolloExample);
}
@Test public void testNojs() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testNojs() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/nojs.html");
// all we need is for it to finish building CG successfully.
JSCallGraphBuilderUtil.makeHTMLCG(url);
}
@Test public void testPage4() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testPage4() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/page4.html");
JSCallGraphBuilderUtil.makeHTMLCG(url);
}
@ -259,7 +258,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
new Object[]{ "suffix:forall_base", "pages/collection.js", 4, 4 }
};
@Test public void testList() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testList() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/list.html");
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
@ -268,7 +267,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
verifySourceAssertions(CG, sourceAssertionsForList);
}
@Test public void testIframeTest2() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testIframeTest2() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/iframeTest2.html");
JSCallGraphBuilderUtil.makeHTMLCG(url);
}
@ -282,7 +281,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
};
@Test public void testWindowx() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testWindowx() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/windowx.html");
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
@ -296,7 +295,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
new Object[] { "windowonload.html/__WINDOW_MAIN__", new String[] { "windowonload.html/__WINDOW_MAIN__/onload_handler" } },
};
@Test public void testWindowOnload() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testWindowOnload() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/windowonload.html");
JSCFABuilder builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url);
CallGraph CG = builder.makeCallGraph(builder.getOptions());
@ -312,7 +311,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
new Object[] { "skeleton.html/__WINDOW_MAIN__/bad_guy", new String[] { "skeleton.html/__WINDOW_MAIN__/dollar" } },
};
@Test public void testSkeleton() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testSkeleton() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/skeleton.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForSkeleton);
@ -328,7 +327,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
new Object[] { "skeleton2.html/__WINDOW_MAIN__/bad_guy", new String[] { "skeleton2.html/__WINDOW_MAIN__/dollar" } },
};
@Test public void testSkeleton2() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testSkeleton2() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/skeleton2.html");
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
System.err.println(CG);
@ -336,7 +335,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
}
/*
@Test public void testJQuery() throws IOException, IllegalArgumentException, CancelException, WalaException {
@Test public void testJQuery() throws IllegalArgumentException, CancelException, WalaException {
URL url = getClass().getClassLoader().getResource("pages/jquery.html");
CallGraph CG = Util.makeHTMLCG(url);
}

View File

@ -102,7 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -93,7 +93,7 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
}
// add flow corresponding to a new call edge
private static void addEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee, IProgressMonitor monitor) throws CancelException {
private static void addEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee, IProgressMonitor monitor) {
VertexFactory factory = flowgraph.getVertexFactory();
JavaScriptInvoke invk = c.getInstruction();
FuncVertex caller = c.getCaller();

View File

@ -133,7 +133,7 @@ public class WorklistBasedOptimisticCallgraphBuilder extends FieldBasedCallGraph
}
// add flow corresponding to a new call edge
private void addCallEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee, Set<Vertex> worklist) throws CancelException {
private void addCallEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee, Set<Vertex> worklist) {
VertexFactory factory = flowgraph.getVertexFactory();
FuncVertex caller = c.getCaller();
JavaScriptInvoke invk = c.getInstruction();
@ -161,7 +161,7 @@ public class WorklistBasedOptimisticCallgraphBuilder extends FieldBasedCallGraph
// add data flow corresponding to a reflective invocation via Function.prototype.call
// NB: for f.call(...), f will _not_ appear as a call target, but the appropriate argument and return data flow will be set up
private void addReflectiveCallEdge(FlowGraph flowgraph, VarVertex reflectiveCallee, JavaScriptInvoke invk, FuncVertex realCallee, Set<Vertex> worklist) throws CancelException {
private void addReflectiveCallEdge(FlowGraph flowgraph, VarVertex reflectiveCallee, JavaScriptInvoke invk, FuncVertex realCallee, Set<Vertex> worklist) {
VertexFactory factory = flowgraph.getVertexFactory();
FuncVertex caller = reflectiveCallee.getFunction();

View File

@ -10,7 +10,6 @@
*****************************************************************************/
package com.ibm.wala.cast.js.client;
import java.io.IOException;
import java.util.Collections;
import java.util.Set;
import java.util.jar.JarFile;
@ -59,15 +58,11 @@ public abstract class JavaScriptAnalysisEngine<I extends InstanceKey> extends Ab
@Override
public void buildAnalysisScope() {
try {
loaderFactory = new JavaScriptLoaderFactory(translatorFactory);
loaderFactory = new JavaScriptLoaderFactory(translatorFactory);
SourceModule[] files = moduleFiles.toArray(new SourceModule[moduleFiles.size()]);
SourceModule[] files = moduleFiles.toArray(new SourceModule[moduleFiles.size()]);
scope = new CAstAnalysisScope(files, loaderFactory, Collections.singleton(JavaScriptLoader.JS));
} catch (IOException e) {
Assertions.UNREACHABLE(e.toString());
}
scope = new CAstAnalysisScope(files, loaderFactory, Collections.singleton(JavaScriptLoader.JS));
}
@Override

View File

@ -283,7 +283,7 @@ public class DomLessSourceExtractor extends JSSourceExtractor {
}
}
protected String getScriptName(URL url) throws MalformedURLException {
protected String getScriptName(URL url) {
String file = url.getFile();
int lastIdxOfSlash = file.lastIndexOf('/');
file = (lastIdxOfSlash == (-1)) ? file : file.substring(lastIdxOfSlash + 1);

View File

@ -120,7 +120,7 @@ public class JSCallGraphUtil extends com.ibm.wala.cast.ipa.callgraph.CAstCallGra
return makeLoaders(null);
}
public static IClassHierarchy makeHierarchyForScripts(String... scriptFiles) throws IOException, ClassHierarchyException {
public static IClassHierarchy makeHierarchyForScripts(String... scriptFiles) throws ClassHierarchyException {
JavaScriptLoaderFactory loaders = makeLoaders();
AnalysisScope scope = CAstCallGraphUtil.makeScope(scriptFiles, loaders, JavaScriptLoader.JS);
return makeHierarchy(scope, loaders);

View File

@ -12,7 +12,6 @@
package com.ibm.wala.cast.js.ipa.callgraph.correlations;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@ -240,7 +239,7 @@ public class CorrelationFinder {
}
@SuppressWarnings("unused")
private void printCorrelatedAccesses(URL url) throws IOException, ClassHierarchyException {
private void printCorrelatedAccesses(URL url) throws ClassHierarchyException {
printCorrelatedAccesses(findCorrelatedAccesses(url));
}
@ -261,7 +260,7 @@ public class CorrelationFinder {
System.out.println((i++) + " -- " + p.fst + ": " + p.snd);
}
public Map<IMethod, CorrelationSummary> findCorrelatedAccesses(URL url) throws IOException, ClassHierarchyException {
public Map<IMethod, CorrelationSummary> findCorrelatedAccesses(URL url) throws ClassHierarchyException {
Set<? extends SourceModule> scripts = null;
if(url.getPath().endsWith(".js")) {
scripts = Collections.singleton(new SourceURLModule(url));
@ -278,13 +277,11 @@ public class CorrelationFinder {
return summaries;
}
public Map<IMethod, CorrelationSummary> findCorrelatedAccesses(Collection<? extends SourceModule> scripts) throws IOException,
ClassHierarchyException {
public Map<IMethod, CorrelationSummary> findCorrelatedAccesses(Collection<? extends SourceModule> scripts) throws ClassHierarchyException {
return findCorrelatedAccesses(scripts.toArray(new SourceModule[scripts.size()]));
}
public Map<IMethod, CorrelationSummary> findCorrelatedAccesses(SourceModule[] scripts_array) throws IOException,
ClassHierarchyException {
public Map<IMethod, CorrelationSummary> findCorrelatedAccesses(SourceModule[] scripts_array) throws ClassHierarchyException {
JSCallGraphUtil.setTranslatorFactory(translatorFactory);
JavaScriptLoaderFactory loaders = JSCallGraphUtil.makeLoaders(null);
CAstAnalysisScope scope = new CAstAnalysisScope(scripts_array, loaders, Collections.singleton(JavaScriptLoader.JS));

View File

@ -11,7 +11,6 @@
package com.ibm.wala.cast.js.ipa.callgraph.correlations.extraction;
import java.io.IOException;
import java.net.URL;
import java.util.Map;
@ -29,11 +28,11 @@ import com.ibm.wala.ipa.cha.ClassHierarchyException;
public class CorrelatedPairExtractorFactory implements CAstRewriterFactory<NodePos, NoKey> {
private final Map<IMethod, CorrelationSummary> summaries;
public CorrelatedPairExtractorFactory(JavaScriptTranslatorFactory translatorFactory, URL entryPoint) throws ClassHierarchyException, IOException {
public CorrelatedPairExtractorFactory(JavaScriptTranslatorFactory translatorFactory, URL entryPoint) throws ClassHierarchyException {
this(new CorrelationFinder(translatorFactory).findCorrelatedAccesses(entryPoint));
}
public CorrelatedPairExtractorFactory(JavaScriptTranslatorFactory translatorFactory, SourceModule[] scripts) throws ClassHierarchyException, IOException {
public CorrelatedPairExtractorFactory(JavaScriptTranslatorFactory translatorFactory, SourceModule[] scripts) throws ClassHierarchyException {
this(new CorrelationFinder(translatorFactory).findCorrelatedAccesses(scripts));
}

View File

@ -103,7 +103,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -10,7 +10,6 @@
package com.ibm.wala.cast.ipa.callgraph;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
@ -31,8 +30,7 @@ public class CAstAnalysisScope extends AnalysisScope {
this.theLoader = loaders.getTheReference();
}
public CAstAnalysisScope(String[] sourceFileNames, SingleClassLoaderFactory loaders, Collection<Language> languages)
throws IOException {
public CAstAnalysisScope(String[] sourceFileNames, SingleClassLoaderFactory loaders, Collection<Language> languages) {
this(loaders, languages);
for (int i = 0; i < sourceFileNames.length; i++) {
File F = new File(sourceFileNames[i]);
@ -40,8 +38,7 @@ public class CAstAnalysisScope extends AnalysisScope {
}
}
public CAstAnalysisScope(Module[] sources, SingleClassLoaderFactory loaders, Collection<Language> languages)
throws IOException {
public CAstAnalysisScope(Module[] sources, SingleClassLoaderFactory loaders, Collection<Language> languages) {
this(loaders, languages);
for (int i = 0; i < sources.length; i++) {
addToScope(theLoader, sources[i]);

View File

@ -80,13 +80,12 @@ public class CAstCallGraphUtil {
};
}
public static AnalysisScope makeScope(String[] files, SingleClassLoaderFactory loaders, Language language) throws IOException {
public static AnalysisScope makeScope(String[] files, SingleClassLoaderFactory loaders, Language language) {
CAstAnalysisScope result = new CAstAnalysisScope(files, loaders, Collections.singleton(language));
return result;
}
public static AnalysisScope makeScope(Module[] files, SingleClassLoaderFactory loaders, Language language)
throws IOException {
public static AnalysisScope makeScope(Module[] files, SingleClassLoaderFactory loaders, Language language) {
CAstAnalysisScope result = new CAstAnalysisScope(files, loaders, Collections.singleton(language));
return result;
}

View File

@ -102,7 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -144,7 +144,7 @@ public class ArrayboundsAnalysisTest {
}
@AfterClass
public static void free() throws IOException, ClassHierarchyException {
public static void free() {
scope = null;
cha = null;
irFactory = null;

View File

@ -130,7 +130,7 @@ public class PruneArrayOutOfBoundExceptionEdge {
}
@Test
public void detectable() throws ClassNotFoundException {
public void detectable() {
IClass iClass = getIClass(DETECTABLE_TESTDATA);
checkRemovedEdges(iClass, DETECTABLE_EXPECTED_COUNT);
}
@ -235,7 +235,7 @@ public class PruneArrayOutOfBoundExceptionEdge {
}
@AfterClass
public static void free() throws IOException, ClassHierarchyException {
public static void free() {
scope = null;
cha = null;
irFactory = null;

View File

@ -13,7 +13,6 @@ package com.ibm.wala.core.tests.callGraph;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.jar.JarFile;
import org.junit.Test;
@ -42,13 +41,13 @@ import com.ibm.wala.util.io.TemporaryFile;
public class Java7CallGraphTest extends DynamicCallGraphTestBase {
@Test public void testOcamlHelloHash() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InterruptedException {
@Test public void testOcamlHelloHash() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, InterruptedException {
if (!"True".equals(System.getenv("APPVEYOR"))) {
testOCamlJar("hello_hash.jar");
}
}
private void testOCamlJar(String jarFile, String... args) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InterruptedException {
private void testOCamlJar(String jarFile, String... args) throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, InterruptedException {
File F = TemporaryFile.urlToFile(jarFile.replace('.', '_') + ".jar", getClass().getClassLoader().getResource(jarFile));
F.deleteOnExit();

View File

@ -89,8 +89,7 @@ public class AnnotationTest extends WalaTestCase {
}
private void testClassAnnotations(TypeReference typeUnderTest, Collection<Annotation> expectedRuntimeInvisibleAnnotations,
Collection<Annotation> expectedRuntimeVisibleAnnotations) throws IOException, ClassHierarchyException,
InvalidClassFileException {
Collection<Annotation> expectedRuntimeVisibleAnnotations) throws InvalidClassFileException {
IClass classUnderTest = cha.lookupClass(typeUnderTest);
harness.assertNotNull(typeUnderTest.toString() + " not found", classUnderTest);
harness.assertTrue(classUnderTest + " must be BytecodeClass", classUnderTest instanceof BytecodeClass);

View File

@ -252,8 +252,7 @@ public class TypeAnnotationTest extends WalaTestCase {
}
private void testClassAnnotations(TypeReference typeUnderTest, Collection<TypeAnnotation> expectedRuntimeInvisibleAnnotations,
Collection<TypeAnnotation> expectedRuntimeVisibleAnnotations) throws IOException, ClassHierarchyException,
InvalidClassFileException {
Collection<TypeAnnotation> expectedRuntimeVisibleAnnotations) throws InvalidClassFileException {
IClass classUnderTest = cha.lookupClass(typeUnderTest);
harness.assertNotNull(typeUnderTest.toString() + " not found", classUnderTest);
harness.assertTrue(classUnderTest + " must be BytecodeClass", classUnderTest instanceof ShrikeClass);
@ -267,8 +266,7 @@ public class TypeAnnotationTest extends WalaTestCase {
}
private void testMethodAnnotations(MethodReference methodRefUnderTest, Collection<TypeAnnotation> expectedRuntimeInvisibleAnnotations,
Collection<TypeAnnotation> expectedRuntimeVisibleAnnotations) throws IOException, ClassHierarchyException,
InvalidClassFileException {
Collection<TypeAnnotation> expectedRuntimeVisibleAnnotations) throws InvalidClassFileException {
IMethod methodUnderTest = cha.resolveMethod(methodRefUnderTest);
harness.assertNotNull(methodRefUnderTest.toString() + " not found", methodUnderTest);
harness.assertTrue(methodUnderTest + " must be ShrikeCTMethod", methodUnderTest instanceof ShrikeCTMethod);
@ -286,8 +284,7 @@ public class TypeAnnotationTest extends WalaTestCase {
}
private void testFieldAnnotations(String fieldNameStr, TypeReference typeUnderTest, Collection<TypeAnnotation> expectedAnnotations) throws IOException, ClassHierarchyException,
InvalidClassFileException {
private void testFieldAnnotations(String fieldNameStr, TypeReference typeUnderTest, Collection<TypeAnnotation> expectedAnnotations) {
IClass classUnderTest = cha.lookupClass(typeUnderTest);
harness.assertNotNull(typeUnderTest.toString() + " not found", classUnderTest);
harness.assertTrue(classUnderTest + " must be BytecodeClass", classUnderTest instanceof ShrikeClass);

View File

@ -12,7 +12,6 @@
package com.ibm.wala.core.tests.shrike;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import org.junit.Test;
@ -51,7 +50,7 @@ public class DynamicCallGraphTest extends DynamicCallGraphTestBase {
}
@Test
public void testGraph() throws IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassHierarchyException, CancelException, InterruptedException {
public void testGraph() throws IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, IllegalArgumentException, ClassHierarchyException, CancelException, InterruptedException {
instrument(testJarLocation);
run("dynamicCG.MainClass", null);
CallGraph staticCG = staticCG("LdynamicCG/MainClass", null);
@ -59,7 +58,7 @@ public class DynamicCallGraphTest extends DynamicCallGraphTestBase {
}
@Test
public void testCallbacks() throws IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassHierarchyException, CancelException, InterruptedException {
public void testCallbacks() throws IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, IllegalArgumentException, ClassHierarchyException, CancelException, InterruptedException {
instrument(testJarLocation);
run("dynamicCG.CallbacksMainClass", null);
CallGraph staticCG = staticCG("LdynamicCG/CallbacksMainClass", null);
@ -67,7 +66,7 @@ public class DynamicCallGraphTest extends DynamicCallGraphTestBase {
}
@Test
public void testExclusions() throws IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassHierarchyException, CancelException, InterruptedException {
public void testExclusions() throws IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, IllegalArgumentException, ClassHierarchyException, CancelException, InterruptedException {
instrument(testJarLocation);
run("dynamicCG.MainClass", "ShrikeTestExclusions.txt");
CallGraph staticCG = staticCG("LdynamicCG/MainClass", "ShrikeTestExclusions.txt");

View File

@ -16,7 +16,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -99,7 +98,7 @@ public abstract class DynamicCallGraphTestBase extends WalaTestCase {
}
}
protected void run(String mainClass, String exclusionsFile, String... args) throws IOException, ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, InterruptedException {
protected void run(String mainClass, String exclusionsFile, String... args) throws IOException, SecurityException, IllegalArgumentException, InterruptedException {
Project p = new Project();
p.setBaseDir(new File(System.getProperty("java.io.tmpdir")));
p.init();

View File

@ -835,7 +835,7 @@ public class SlicerTest {
}
@Test
public void testJustThrow() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException, UnsoundGraphException {
public void testJustThrow() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = findOrCreateAnalysisScope();
IClassHierarchy cha = findOrCreateCHA(scope);

View File

@ -35,7 +35,6 @@ import com.ibm.wala.ipa.callgraph.propagation.HeapModel;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.types.TypeReference;
@ -161,7 +160,7 @@ public class SimpleThreadEscapeAnalysis extends AbstractAnalysisEngine<InstanceK
* @throws CancelException
* @throws IllegalArgumentException
*/
public Set<IClass> gatherThreadEscapingClasses() throws IOException, ClassHierarchyException, IllegalArgumentException,
public Set<IClass> gatherThreadEscapingClasses() throws IOException, IllegalArgumentException,
CancelException {
//
@ -327,7 +326,7 @@ public class SimpleThreadEscapeAnalysis extends AbstractAnalysisEngine<InstanceK
* @throws CancelException
* @throws IllegalArgumentException
*/
public static void main(String[] args) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException {
public static void main(String[] args) throws IOException, IllegalArgumentException, CancelException {
String mainClassName = args[0];
Set<JarFile> jars = HashSetFactory.make();

View File

@ -53,7 +53,7 @@ public class PDFCallGraph {
return (new File(appJar).isDirectory());
}
public static String findJarFiles(String[] directories) throws WalaException {
public static String findJarFiles(String[] directories) {
Collection<String> result = HashSetFactory.make();
for (int i = 0; i < directories.length; i++) {
for (Iterator<File> it = FileUtil.listFiles(directories[i], ".*\\.jar", true).iterator(); it.hasNext();) {
@ -86,7 +86,7 @@ public class PDFCallGraph {
* @throws CancelException
* @throws IllegalArgumentException
*/
public static void main(String[] args) throws WalaException, IllegalArgumentException, CancelException {
public static void main(String[] args) throws IllegalArgumentException, CancelException {
run(args);
}
@ -97,7 +97,7 @@ public class PDFCallGraph {
* @throws CancelException
* @throws IllegalArgumentException
*/
public static Process run(String[] args) throws WalaException, IllegalArgumentException, CancelException {
public static Process run(String[] args) throws IllegalArgumentException, CancelException {
Properties p = CommandLine.parse(args);
validateCommandLine(p);
return run(p.getProperty("appJar"), p.getProperty("exclusionFile", CallGraphTestUtil.REGRESSION_EXCLUSIONS));
@ -167,7 +167,7 @@ public class PDFCallGraph {
return g;
}
public static Graph<CGNode> pruneForAppLoader(CallGraph g) throws WalaException {
public static Graph<CGNode> pruneForAppLoader(CallGraph g) {
return PDFTypeHierarchy.pruneGraph(g, new ApplicationLoaderFilter());
}

View File

@ -100,7 +100,7 @@ public class PDFSlice {
* -dir argument tells whether to compute a forwards or backwards slice. </ul>
*
*/
public static void main(String[] args) throws WalaException, IllegalArgumentException, CancelException, IOException {
public static void main(String[] args) throws IllegalArgumentException, CancelException, IOException {
run(args);
}
@ -111,7 +111,7 @@ public class PDFSlice {
* @throws IllegalArgumentException
* @throws IOException
*/
public static Process run(String[] args) throws WalaException, IllegalArgumentException, CancelException, IOException {
public static Process run(String[] args) throws IllegalArgumentException, CancelException, IOException {
// parse the command-line into a Properties object
Properties p = CommandLine.parse(args);
// validate that the command-line has the expected format

View File

@ -94,7 +94,7 @@ public class PDFTypeHierarchy {
}
}
public static <T> Graph<T> pruneGraph(Graph<T> g, Predicate<T> f) throws WalaException {
public static <T> Graph<T> pruneGraph(Graph<T> g, Predicate<T> f) {
Collection<T> slice = GraphSlicer.slice(g, f);
return GraphSlicer.prune(g, new CollectionFilter<>(slice));
}
@ -102,7 +102,7 @@ public class PDFTypeHierarchy {
/**
* Restrict g to nodes from the Application loader
*/
public static Graph<IClass> pruneForAppLoader(Graph<IClass> g) throws WalaException {
public static Graph<IClass> pruneForAppLoader(Graph<IClass> g) {
Predicate<IClass> f = new Predicate<IClass>() {
@Override public boolean test(IClass c) {
return (c.getClassLoader().getReference().equals(ClassLoaderReference.Application));
@ -130,7 +130,7 @@ public class PDFTypeHierarchy {
/**
* Return a view of an {@link IClassHierarchy} as a {@link Graph}, with edges from classes to immediate subtypes
*/
public static Graph<IClass> typeHierarchy2Graph(IClassHierarchy cha) throws WalaException {
public static Graph<IClass> typeHierarchy2Graph(IClassHierarchy cha) {
Graph<IClass> result = SlowSparseNumberedGraph.make();
for (IClass c : cha) {
result.addNode(c);

View File

@ -112,12 +112,12 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore

View File

@ -641,7 +641,7 @@ public abstract class ShrikeBTMethod implements IMethod, BytecodeConstants {
instructionIndex = i;
}
public int getProgramCounter() throws InvalidClassFileException {
public int getProgramCounter() {
return info.pcMap[instructionIndex];
}
@ -654,12 +654,7 @@ public abstract class ShrikeBTMethod implements IMethod, BytecodeConstants {
public void visitNew(NewInstruction instruction) {
ClassLoaderReference loader = getReference().getDeclaringClass().getClassLoader();
TypeReference t = ShrikeUtil.makeTypeReference(loader, instruction.getType());
try {
newSites.add(NewSiteReference.make(getProgramCounter(), t));
} catch (InvalidClassFileException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
newSites.add(NewSiteReference.make(getProgramCounter(), t));
}
@Override
@ -684,12 +679,7 @@ public abstract class ShrikeBTMethod implements IMethod, BytecodeConstants {
MethodReference m = MethodReference.findOrCreate(loader.getLanguage(), loader.getReference(), instruction.getClassType(),
instruction.getMethodName(), instruction.getMethodSignature());
int programCounter = 0;
try {
programCounter = getProgramCounter();
} catch (InvalidClassFileException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
programCounter = getProgramCounter();
CallSiteReference site = null;
site = CallSiteReference.make(programCounter, m, instruction.getInvocationCode());
callSites.add(site);

View File

@ -272,7 +272,7 @@ public class CHACallGraph extends BasicCallGraph<CHAContextInterpreter> {
|| cha.getScope().isApplicationLoader(target.getDeclaringClass().getClassLoader()));
}
private CGNode makeNewNode(IMethod method, Context C) throws CancelException {
private CGNode makeNewNode(IMethod method, Context C) {
CGNode n;
Key k = new Key(method, C);
n = new CHANode(method, C);

View File

@ -507,8 +507,7 @@ public class PropagationSystem extends DefaultFixedPointSolver<PointsToSetVariab
return iArrayRef;
}
private void registerArrayInstanceWithAllSuperclassesOfElement(int index, IClass elementClass, int dim)
throws ClassHierarchyException {
private void registerArrayInstanceWithAllSuperclassesOfElement(int index, IClass elementClass, int dim) {
IClass T;
// register the array with each supertype of the element class
T = elementClass.getSuperclass();

View File

@ -760,13 +760,7 @@ public class ClassHierarchy implements IClassHierarchy {
assert n != null : "null n for " + b;
}
Set<IClass> superB;
try {
superB = getSuperclasses(b);
} catch (ClassHierarchyException e1) {
e1.printStackTrace();
Assertions.UNREACHABLE();
superB = null;
}
superB = getSuperclasses(b);
IClass aa = a;
while (aa != null) {
if (b.equals(aa) || superB.contains(aa)) {
@ -775,19 +769,13 @@ public class ClassHierarchy implements IClassHierarchy {
aa = aa.getSuperclass();
}
Set<IClass> superA;
try {
superA = getSuperclasses(a);
} catch (ClassHierarchyException e1) {
e1.printStackTrace();
Assertions.UNREACHABLE();
superA = null;
}
superA = getSuperclasses(a);
Assertions.UNREACHABLE("getLeastCommonSuperclass " + tempA + " " + b + ": " + superA + ", " + superB);
return null;
}
}
private static Set<IClass> getSuperclasses(IClass c) throws ClassHierarchyException {
private static Set<IClass> getSuperclasses(IClass c) {
HashSet<IClass> result = HashSetFactory.make(3);
while (c.getSuperclass() != null) {
result.add(c.getSuperclass());

View File

@ -54,14 +54,14 @@ public class FileProvider {
return getJarFileFromClassLoader(fileName, loader);
}
public URL getResource(String fileName) throws IOException {
public URL getResource(String fileName) {
if (fileName == null) {
throw new IllegalArgumentException("null fileName");
}
return getResource(fileName, FileProvider.class.getClassLoader());
}
public URL getResource(String fileName, ClassLoader loader) throws IOException {
public URL getResource(String fileName, ClassLoader loader) {
if (fileName == null) {
throw new IllegalArgumentException("null fileName");
}

View File

@ -19,7 +19,6 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.impl.DefaultEntrypoint;
import com.ibm.wala.ipa.cha.ClassHierarchyException;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.TypeName;
@ -98,35 +97,28 @@ public class JUnitEntryPoints {
final Set<Entrypoint> entryPts = HashSetFactory.make();
// TODO: improve this so that we don't need to check all the
// classes and method to find a match
try {
for (IClass klass : cha) {
TypeName klassType = klass.getName();
if (klassType.equals(targetType) && isJUnitTestCase(klass)) {
if (DEBUG) {
System.err.println("found test class");
}
// add entry point corresponding to the target method
for (Iterator methodsIt = klass.getDeclaredMethods().iterator(); methodsIt.hasNext();) {
IMethod method = (IMethod) methodsIt.next();
Atom methodAtom = method.getName();
if (methodAtom.equals(targetMethodAtom)) {
entryPts.add(new DefaultEntrypoint(method, cha));
System.out.println("- adding entry point of the call graph: " + methodAtom.toString());
}
}
// add entry points of setUp/tearDown methods
Set<IMethod> setUpTearDowns = getSetUpTearDownMethods(klass);
for (IMethod m : setUpTearDowns) {
entryPts.add(new DefaultEntrypoint(m, cha));
for (IClass klass : cha) {
TypeName klassType = klass.getName();
if (klassType.equals(targetType) && isJUnitTestCase(klass)) {
if (DEBUG) {
System.err.println("found test class");
}
// add entry point corresponding to the target method
for (Iterator methodsIt = klass.getDeclaredMethods().iterator(); methodsIt.hasNext();) {
IMethod method = (IMethod) methodsIt.next();
Atom methodAtom = method.getName();
if (methodAtom.equals(targetMethodAtom)) {
entryPts.add(new DefaultEntrypoint(method, cha));
System.out.println("- adding entry point of the call graph: " + methodAtom.toString());
}
}
// add entry points of setUp/tearDown methods
Set<IMethod> setUpTearDowns = getSetUpTearDownMethods(klass);
for (IMethod m : setUpTearDowns) {
entryPts.add(new DefaultEntrypoint(m, cha));
}
}
} catch (ClassHierarchyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new Iterable<Entrypoint>() {
@Override
@ -184,7 +176,7 @@ public class JUnitEntryPoints {
/**
* Get the "setUp" and "tearDown" methods in the given class
*/
public static Set<IMethod> getSetUpTearDownMethods(IClass testClass) throws ClassHierarchyException {
public static Set<IMethod> getSetUpTearDownMethods(IClass testClass) {
final Atom junitPackage = Atom.findOrCreateAsciiAtom("junit/framework");
final Atom junitClass = Atom.findOrCreateAsciiAtom("TestCase");
final Atom junitSuite = Atom.findOrCreateAsciiAtom("TestSuite");

View File

@ -94,7 +94,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -16,7 +16,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.util.Iterator;
import java.util.List;
@ -92,7 +91,7 @@ public class DalvikCallGraphTestBase extends DynamicCallGraphTestBase {
}
public void dynamicCG(File javaJarPath, String mainClass, String... args) throws FileNotFoundException, IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, InterruptedException {
public void dynamicCG(File javaJarPath, String mainClass, String... args) throws FileNotFoundException, IOException, ClassNotFoundException, InvalidClassFileException, FailureException, SecurityException, IllegalArgumentException, InterruptedException {
File F;
try (final FileInputStream in = new FileInputStream(javaJarPath)) {
F = TemporaryFile.streamToFile(new File("test_jar.jar"), in);

View File

@ -31,7 +31,6 @@ import com.ibm.wala.ipa.callgraph.AnalysisOptions.ReflectionOptions;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.shrikeCT.InvalidClassFileException;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeReference;
@ -81,7 +80,7 @@ public abstract class DroidBenchCGTest extends DalvikCallGraphTestBase {
uncalledFunctions.put("VirtualDispatch2.apk", x);
}
public static Set<IMethod> assertUserCodeReachable(CallGraph cg, Set<MethodReference> uncalled) throws InvalidClassFileException {
public static Set<IMethod> assertUserCodeReachable(CallGraph cg, Set<MethodReference> uncalled) {
Set<IMethod> result = HashSetFactory.make();
for(Iterator<IClass> clss = cg.getClassHierarchy().getLoader(ClassLoaderReference.Application).iterateAllClasses();
clss.hasNext(); )

View File

@ -2,8 +2,6 @@ package com.ibm.wala.dalvik.test.callGraph;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import org.junit.Test;
import com.ibm.wala.core.tests.util.TestConstants;
@ -15,13 +13,13 @@ import com.ibm.wala.util.CancelException;
public class DynamicDalvikComparisonJavaLibsTest extends DynamicDalvikComparisonTest {
@Test
public void testJLex() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InvalidClassFileException, FailureException {
public void testJLex() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, InvalidClassFileException, FailureException {
File inputFile = testFile("sample.lex");
test(null, TestConstants.JLEX_MAIN, TestConstants.JLEX, inputFile.getAbsolutePath());
}
@Test
public void testJavaCup() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InvalidClassFileException, FailureException {
public void testJavaCup() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, InvalidClassFileException, FailureException {
File inputFile = testFile("sample.cup");
test(null, TestConstants.JAVA_CUP_MAIN, TestConstants.JAVA_CUP, inputFile.getAbsolutePath());
}

View File

@ -15,7 +15,6 @@ import static com.ibm.wala.dalvik.test.util.Util.getJavaJar;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
@ -35,7 +34,7 @@ import com.ibm.wala.util.io.TemporaryFile;
public abstract class DynamicDalvikComparisonTest extends DalvikCallGraphTestBase {
protected void test(URI[] androidLibs, String mainClass, String javaScopeFile, String... args) throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InvalidClassFileException, FailureException {
protected void test(URI[] androidLibs, String mainClass, String javaScopeFile, String... args) throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, InvalidClassFileException, FailureException {
AnalysisScope javaScope = CallGraphTestUtil.makeJ2SEAnalysisScope(javaScopeFile, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
String javaJarPath = getJavaJar(javaScope);
File androidDex = convertJarToDex(javaJarPath);

View File

@ -4,7 +4,6 @@ import static com.ibm.wala.dalvik.test.util.Util.androidLibs;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import org.junit.Test;
@ -22,13 +21,13 @@ public class DynamicDalvikComparisonTestForAndroidLibs extends DynamicDalvikComp
}
@Test
public void testJLex() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InvalidClassFileException, FailureException {
public void testJLex() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, InvalidClassFileException, FailureException {
File inputFile = testFile("sample.lex");
test(providedAndroidLibs(), TestConstants.JLEX_MAIN, TestConstants.JLEX, inputFile.getAbsolutePath());
}
@Test
public void testJavaCup() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InvalidClassFileException, FailureException {
public void testJavaCup() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException, ClassNotFoundException, SecurityException, InvalidClassFileException, FailureException {
File inputFile = testFile("sample.cup");
test(providedAndroidLibs(), TestConstants.JAVA_CUP_MAIN, TestConstants.JAVA_CUP, inputFile.getAbsolutePath());
}

View File

@ -81,7 +81,7 @@ public class JVMLDalvikComparisonTest extends DalvikCallGraphTestBase {
return result;
}
private static void test(String mainClass, String javaScopeFile) throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException {
private static void test(String mainClass, String javaScopeFile) throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException {
Pair<CallGraph, PointerAnalysis<InstanceKey>> java = makeJavaBuilder(javaScopeFile, mainClass);
AnalysisScope javaScope = java.fst.getClassHierarchy().getScope();
@ -126,17 +126,17 @@ public class JVMLDalvikComparisonTest extends DalvikCallGraphTestBase {
}
@Test
public void testJLex() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException {
public void testJLex() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException {
test(TestConstants.JLEX_MAIN, TestConstants.JLEX);
}
@Test
public void testJavaCup() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException {
public void testJavaCup() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException {
test(TestConstants.JAVA_CUP_MAIN, TestConstants.JAVA_CUP);
}
@Test
public void testBCEL() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException, InterruptedException {
public void testBCEL() throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException {
test(TestConstants.BCEL_VERIFIER_MAIN, TestConstants.BCEL);
}
}

View File

@ -15,7 +15,6 @@ import java.io.IOException;
import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.junit.Assert;
import com.ibm.wala.cast.java.client.JDTJavaSourceAnalysisEngine;
@ -51,34 +50,26 @@ public abstract class JDTJavaTest extends IRTests {
static <I extends InstanceKey> AbstractAnalysisEngine<I> makeAnalysisEngine(final String[] mainClassDescriptors, Collection<String> sources, List<String> libs, ZippedProjectData project) {
AbstractAnalysisEngine<I> engine;
try {
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);
engine = new JDTJavaSourceAnalysisEngine<I>(project.projectName) {
{
setDump(Boolean.parseBoolean(System.getProperty("wala.cast.dump", "false")));
}
return engine;
} catch (IOException e1) {
Assert.fail(e1.getMessage());
return null;
} catch (CoreException e1) {
Assert.fail(e1.getMessage());
return null;
@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;
}
}

View File

@ -66,11 +66,11 @@ import com.ibm.wala.util.config.SetOfClasses;
public class JDTJavaSourceAnalysisEngine<I extends InstanceKey> extends EclipseProjectSourceAnalysisEngine<IJavaProject, I> {
private boolean dump;
public JDTJavaSourceAnalysisEngine(IJavaProject project) throws IOException, CoreException {
public JDTJavaSourceAnalysisEngine(IJavaProject project) {
super(project);
}
public JDTJavaSourceAnalysisEngine(String projectName) throws IOException, CoreException {
public JDTJavaSourceAnalysisEngine(String projectName) {
this(JdtUtil.getNamedProject(projectName));
}

View File

@ -73,8 +73,7 @@ public class JDTClassLoaderFactory extends ClassLoaderFactoryImpl {
}
}
protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent)
throws IOException {
protected JavaSourceLoaderImpl makeSourceLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent) {
return new JDTSourceLoaderImpl(classLoaderReference, parent, getExclusions(), cha, dump);
}
}

View File

@ -37,8 +37,6 @@
*/
package com.ibm.wala.cast.java.translator.jdt;
import java.io.IOException;
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
import com.ibm.wala.cast.java.translator.SourceModuleTranslator;
import com.ibm.wala.classLoader.IClassLoader;
@ -49,11 +47,11 @@ import com.ibm.wala.util.config.SetOfClasses;
public class JDTSourceLoaderImpl extends JavaSourceLoaderImpl {
private final boolean dump;
public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) throws IOException {
public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha) {
this(loaderRef, parent, exclusions, cha, false);
}
public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha, boolean dump) throws IOException {
public JDTSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions, IClassHierarchy cha, boolean dump) {
super(loaderRef, parent, exclusions, cha);
this.dump = dump;
}

View File

@ -47,8 +47,7 @@ public class JavaEclipseProjectPath extends EclipseProjectPath<IClasspathEntry,
}
}
protected JavaEclipseProjectPath(com.ibm.wala.ide.util.EclipseProjectPath.AnalysisScopeType scopeType)
throws IOException, CoreException {
protected JavaEclipseProjectPath(com.ibm.wala.ide.util.EclipseProjectPath.AnalysisScopeType scopeType) {
super(scopeType);
}

View File

@ -102,7 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -37,7 +37,6 @@ import com.ibm.wala.ide.util.JsdtUtil.CGInfo;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.util.CancelException;
import com.ibm.wala.util.collections.Pair;
public abstract class AbstractJSProjectScopeTest {
@ -82,7 +81,7 @@ public abstract class AbstractJSProjectScopeTest {
}
@Test
public void testEngine() throws IOException, CoreException, IllegalArgumentException, CancelException {
public void testEngine() throws IOException, IllegalArgumentException {
IJavaScriptProject p = JavaScriptHeadlessUtil.getJavaScriptProjectFromWorkspace(project.projectName);
EclipseJavaScriptAnalysisEngine<InstanceKey> e = makeAnalysisEngine(p);
JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
@ -92,7 +91,7 @@ public abstract class AbstractJSProjectScopeTest {
Assert.assertTrue(cha != null);
}
protected EclipseJavaScriptAnalysisEngine<InstanceKey> makeAnalysisEngine(IJavaScriptProject p) throws IOException, CoreException {
protected EclipseJavaScriptAnalysisEngine<InstanceKey> makeAnalysisEngine(IJavaScriptProject p) {
return new EclipseJavaScriptAnalysisEngine<>(p, BuilderType.REFLECTIVE);
}

View File

@ -65,7 +65,7 @@ public class EclipseJavaScriptAnalysisEngine<I extends InstanceKey> extends Ecli
private final BuilderType builderType;
public EclipseJavaScriptAnalysisEngine(IJavaScriptProject project, BuilderType builderType) throws IOException, CoreException {
public EclipseJavaScriptAnalysisEngine(IJavaScriptProject project, BuilderType builderType) {
super(project, "js");
this.builderType = builderType;
}

View File

@ -33,7 +33,7 @@ public class EclipseWebAnalysisEngine extends EclipseJavaScriptAnalysisEngine<In
private final Set<Pair<String, Plugin>> models = HashSetFactory.make();
public EclipseWebAnalysisEngine(IJavaScriptProject project, Collection<Pair<String, Plugin>> models, BuilderType builderType) throws IOException, CoreException {
public EclipseWebAnalysisEngine(IJavaScriptProject project, Collection<Pair<String, Plugin>> models, BuilderType builderType) {
super(project, builderType);
// core DOM model
this.models.add(Pair.make("preamble.js", (Plugin)Activator.getDefault()));

View File

@ -24,7 +24,7 @@ import com.ibm.wala.util.collections.Pair;
public class EclipseWebProjectPath extends JavaScriptEclipseProjectPath {
public EclipseWebProjectPath(Set<Pair<String, Plugin>> models) throws IOException, CoreException {
public EclipseWebProjectPath(Set<Pair<String, Plugin>> models) {
super(models);
}

View File

@ -51,8 +51,7 @@ public class JavaScriptEclipseProjectPath extends EclipseProjectPath<IIncludePat
private final Set<Pair<String, Plugin>> models = HashSetFactory.make();
protected JavaScriptEclipseProjectPath(Set<Pair<String, Plugin>> models) throws IOException,
CoreException {
protected JavaScriptEclipseProjectPath(Set<Pair<String, Plugin>> models) {
super(AnalysisScopeType.SOURCE_FOR_PROJ_AND_LINKED_PROJS);
this.models.addAll(models);
this.models.add(Pair.make("prologue.js", (Plugin)Activator.getDefault()));

View File

@ -102,7 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -24,7 +24,6 @@ import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.Predicate;
import com.ibm.wala.util.WalaException;
import com.ibm.wala.util.collections.CollectionFilter;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.graph.Graph;
@ -85,7 +84,7 @@ public class SWTTypeHierarchy {
/**
* Return a view of an {@link IClassHierarchy} as a {@link Graph}, with edges from classes to immediate subtypes
*/
public static Graph<IClass> typeHierarchy2Graph(IClassHierarchy cha) throws WalaException {
public static Graph<IClass> typeHierarchy2Graph(IClassHierarchy cha) {
Graph<IClass> result = SlowSparseNumberedGraph.make();
for (IClass c : cha) {
result.addNode(c);
@ -106,7 +105,7 @@ public class SWTTypeHierarchy {
/**
* Restrict g to nodes from the Application loader
*/
static Graph<IClass> pruneForAppLoader(Graph<IClass> g) throws WalaException {
static Graph<IClass> pruneForAppLoader(Graph<IClass> g) {
Predicate<IClass> f = new Predicate<IClass>() {
@Override public boolean test(IClass c) {
return (c.getClassLoader().getReference().equals(ClassLoaderReference.Application));
@ -118,7 +117,7 @@ public class SWTTypeHierarchy {
/**
* Remove from a graph g any nodes that are not accepted by a {@link Predicate}
*/
public static <T> Graph<T> pruneGraph(Graph<T> g, Predicate<T> f) throws WalaException {
public static <T> Graph<T> pruneGraph(Graph<T> g, Predicate<T> f) {
Collection<T> slice = GraphSlicer.slice(g, f);
return GraphSlicer.prune(g, new CollectionFilter<>(slice));
}

View File

@ -102,7 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -38,7 +38,7 @@ abstract public class EclipseProjectAnalysisEngine<P, I extends InstanceKey> ext
protected EclipseProjectPath<?,P> ePath;
public EclipseProjectAnalysisEngine(P project) throws IOException, CoreException {
public EclipseProjectAnalysisEngine(P project) {
super();
this.project = project;
this.workspaceRootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation();

View File

@ -12,8 +12,6 @@ package com.ibm.wala.ide.client;
import java.io.IOException;
import org.eclipse.core.runtime.CoreException;
import com.ibm.wala.ide.plugin.CorePlugin;
import com.ibm.wala.ide.util.EclipseFileProvider;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
@ -38,11 +36,11 @@ abstract public class EclipseProjectSourceAnalysisEngine<P, I extends InstanceKe
*/
final String fileExt;
public EclipseProjectSourceAnalysisEngine(P project) throws IOException, CoreException {
public EclipseProjectSourceAnalysisEngine(P project) {
this(project, defaultFileExt);
}
public EclipseProjectSourceAnalysisEngine(P project, String fileExt) throws IOException, CoreException {
public EclipseProjectSourceAnalysisEngine(P project, String fileExt) {
super(project);
this.fileExt = fileExt;
try {

View File

@ -185,7 +185,7 @@ public class EclipseFileProvider extends FileProvider {
}
@Override
public URL getResource(String fileName, ClassLoader loader) throws IOException {
public URL getResource(String fileName, ClassLoader loader) {
if (fileName == null) {
throw new IllegalArgumentException("null fileName");
}

View File

@ -118,7 +118,7 @@ public abstract class EclipseProjectPath<E, P> {
*/
private final AnalysisScopeType scopeType;
protected EclipseProjectPath(AnalysisScopeType scopeType) throws IOException, CoreException {
protected EclipseProjectPath(AnalysisScopeType scopeType) {
this.scopeType = scopeType;
for (ILoader loader : Loader.values()) {
MapUtil.findOrCreateList(modules, loader);

View File

@ -112,7 +112,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -562,7 +562,7 @@ public class Analyzer {
return changed;
}
private boolean mergeLocalTypes(int i, String[] curLocals, int curLocalsSize, List<PathElement> path) throws FailureException {
private boolean mergeLocalTypes(int i, String[] curLocals, int curLocalsSize, List<PathElement> path) {
boolean changed = false;
if (locals[i] == null) {

View File

@ -86,38 +86,22 @@ final public class CTDecoder extends Decoder {
@Override
public int getConstantPoolInteger(int index) {
try {
return cp.getCPInt(index);
} catch (InvalidClassFileException e) {
throw convertToError(e);
}
return cp.getCPInt(index);
}
@Override
public float getConstantPoolFloat(int index) {
try {
return cp.getCPFloat(index);
} catch (InvalidClassFileException e) {
throw convertToError(e);
}
return cp.getCPFloat(index);
}
@Override
public long getConstantPoolLong(int index) {
try {
return cp.getCPLong(index);
} catch (InvalidClassFileException e) {
throw convertToError(e);
}
return cp.getCPLong(index);
}
@Override
public double getConstantPoolDouble(int index) {
try {
return cp.getCPDouble(index);
} catch (InvalidClassFileException e) {
throw convertToError(e);
}
return cp.getCPDouble(index);
}
@Override

View File

@ -91,7 +91,7 @@ final public class ClassInstrumenter {
*
* @throws IllegalArgumentException if cr is null
*/
public ClassInstrumenter(String inputName, ClassReader cr, ClassHierarchyProvider cha) throws InvalidClassFileException {
public ClassInstrumenter(String inputName, ClassReader cr, ClassHierarchyProvider cha) {
if (cr == null) {
throw new IllegalArgumentException("cr is null");
}

View File

@ -12,7 +12,6 @@ package com.ibm.wala.shrikeBT.shrikeCT.tools;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.lang.invoke.CallSite;
@ -73,7 +72,7 @@ public class BootstrapDumper {
}
private void dumpAttributes(Class<?> cl, ClassReader cr, int i, ClassReader.AttrIterator attrs) throws InvalidClassFileException,
InvalidBytecodeException, IOException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
InvalidBytecodeException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
for (; attrs.isValid(); attrs.advance()) {
String name = attrs.getName();
if (name.equals("Code")) {
@ -114,7 +113,7 @@ public class BootstrapDumper {
* @throws IllegalArgumentException if cr is null
* @throws NoSuchFieldException
*/
public void doClass(ClassLoader image, final ClassReader cr) throws InvalidClassFileException, InvalidBytecodeException, IOException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
public void doClass(ClassLoader image, final ClassReader cr) throws InvalidClassFileException, InvalidBytecodeException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
if (cr == null) {
throw new IllegalArgumentException("cr is null");
}

View File

@ -11,7 +11,6 @@
package com.ibm.wala.shrikeBT.shrikeCT.tools;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
@ -82,7 +81,7 @@ public class BootstrapInstrumentor {
}
private Set<MethodData> dumpAttributes(ClassInstrumenter ci, int i, ClassReader.AttrIterator attrs) throws InvalidClassFileException,
InvalidBytecodeException, IOException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
InvalidBytecodeException, SecurityException, IllegalArgumentException {
Set<MethodData> result = HashSetFactory.make();
ClassReader cr = ci.getReader();
for (; attrs.isValid(); attrs.advance()) {
@ -140,7 +139,7 @@ public class BootstrapInstrumentor {
* @throws IllegalArgumentException if cr is null
* @throws NoSuchFieldException
*/
public Set<MethodData> doClass(final ClassInstrumenter ci) throws InvalidClassFileException, InvalidBytecodeException, IOException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
public Set<MethodData> doClass(final ClassInstrumenter ci) throws InvalidClassFileException, InvalidBytecodeException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
ClassReader cr = ci.getReader();
ClassReader.AttrIterator attrs = new ClassReader.AttrIterator();
cr.initClassAttributeIterator(attrs);

View File

@ -243,7 +243,7 @@ public abstract class OfflineInstrumenterBase {
/**
* Add a JAR entry containing a source class to instrument.
*/
final public void addInputJarEntry(File f, String name) throws IOException {
final public void addInputJarEntry(File f, String name) {
inputs.add(new JarInput(f, name));
}

View File

@ -437,7 +437,7 @@ public final class ConstantPoolParser implements ClassConstants {
/**
* @return the value of the Integer at constant pool item i
*/
public int getCPInt(int i) throws InvalidClassFileException, IllegalArgumentException {
public int getCPInt(int i) throws IllegalArgumentException {
if (i < 1 || i >= cpItems.length) {
throw new IllegalArgumentException("Constant pool item #" + i + " out of range");
}
@ -451,7 +451,7 @@ public final class ConstantPoolParser implements ClassConstants {
/**
* @return the value of the Float at constant pool item i
*/
public float getCPFloat(int i) throws InvalidClassFileException, IllegalArgumentException {
public float getCPFloat(int i) throws IllegalArgumentException {
if (i < 1 || i >= cpItems.length) {
throw new IllegalArgumentException("Constant pool item #" + i + " out of range");
}
@ -465,7 +465,7 @@ public final class ConstantPoolParser implements ClassConstants {
/**
* @return the value of the Long at constant pool item i
*/
public long getCPLong(int i) throws InvalidClassFileException, IllegalArgumentException {
public long getCPLong(int i) throws IllegalArgumentException {
if (i < 1 || i >= cpItems.length) {
throw new IllegalArgumentException("Constant pool item #" + i + " out of range");
}
@ -479,7 +479,7 @@ public final class ConstantPoolParser implements ClassConstants {
/**
* @return the value of the Double at constant pool item i
*/
public double getCPDouble(int i) throws InvalidClassFileException, IllegalArgumentException {
public double getCPDouble(int i) throws IllegalArgumentException {
if (i < 1 || i >= cpItems.length) {
throw new IllegalArgumentException("Constant pool item #" + i + " out of range");
}

View File

@ -197,7 +197,7 @@ public class StackMapTableWriter extends Element {
return false;
}
public static List<StackMapFrame> stackMapTable(ClassWriter writer, MethodData method, Output output, ClassHierarchyProvider cha, String[][] vars, List<StackMapFrame> reuseFrames) throws FailureException, IOException {
public static List<StackMapFrame> stackMapTable(ClassWriter writer, MethodData method, Output output, ClassHierarchyProvider cha, String[][] vars, List<StackMapFrame> reuseFrames) throws FailureException {
int idx = 0;
List<StackMapFrame> frames = new ArrayList<>();

View File

@ -102,7 +102,7 @@ org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled

View File

@ -273,7 +273,7 @@ public abstract class Launcher {
/**
* Drain some data from the input stream, and print said data to p. Do not block.
*/
private static void drainAndPrint(BufferedInputStream s, PrintStream p) throws IOException {
private static void drainAndPrint(BufferedInputStream s, PrintStream p) {
try {
while (s.available() > 0) {
byte[] data = new byte[s.available()];
@ -289,7 +289,7 @@ public abstract class Launcher {
/**
* Drain all data from the input stream, and print said data to p. Block if necessary.
*/
private static void blockingDrainAndPrint(BufferedInputStream s, PrintStream p) throws IOException {
private static void blockingDrainAndPrint(BufferedInputStream s, PrintStream p) {
ByteArrayOutputStream b = new ByteArrayOutputStream();
try {
// gather all the data from the stream.
@ -310,7 +310,7 @@ public abstract class Launcher {
/**
* Drain some data from the input stream, and append said data to b. Do not block.
*/
private static void drainAndCatch(BufferedInputStream s, ByteArrayOutputStream b) throws IOException {
private static void drainAndCatch(BufferedInputStream s, ByteArrayOutputStream b) {
try {
while (s.available() > 0) {
byte[] data = new byte[s.available()];
@ -326,7 +326,7 @@ public abstract class Launcher {
/**
* Drain all data from the input stream, and append said data to p. Block if necessary.
*/
private static void blockingDrainAndCatch(BufferedInputStream s, ByteArrayOutputStream b) throws IOException {
private static void blockingDrainAndCatch(BufferedInputStream s, ByteArrayOutputStream b) {
try {
int next = s.read();
while (next != -1) {

View File

@ -248,11 +248,11 @@ public class DotUtil {
/**
* Compute the nodes to visualize
*/
private static <T> Collection<T> computeDotNodes(Graph<T> g) throws WalaException {
private static <T> Collection<T> computeDotNodes(Graph<T> g) {
return Iterator2Collection.toSet(g.iterator());
}
private static String getRankDir() throws WalaException {
private static String getRankDir() {
return null;
}