From 191904d6073ccabde93ff625cd80cb1e4d7cd393 Mon Sep 17 00:00:00 2001 From: Ben Liblit Date: Thu, 27 Jul 2017 16:53:07 -0500 Subject: [PATCH] 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. --- .../jdt/ecj/ECJClassLoaderFactory.java | 3 +- .../jdt/ecj/ECJSourceLoaderImpl.java | 6 +-- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../com/ibm/wala/cast/java/test/IRTests.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../java/loader/JavaSourceLoaderImpl.java | 4 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../js/nodejs/NodejsCallGraphBuilderUtil.java | 5 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../test/AbstractFieldBasedTest.java | 7 ++- .../test/FieldBasedComparisonTest.java | 16 +++---- .../fieldbased/test/TestFieldBasedCG.java | 38 +++++++-------- .../ibm/wala/cast/js/rhino/test/PrintIRs.java | 2 +- .../wala/cast/js/test/TestRhinoSourceMap.java | 3 +- .../TestSimplePageCallGraphShapeRhino.java | 5 +- ...tSimplePageCallGraphShapeRhinoJericho.java | 5 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../wala/cast/js/test/FieldBasedCGUtil.java | 10 ++-- .../cast/js/test/JSCallGraphBuilderUtil.java | 20 ++++---- .../js/test/TestAjaxsltCallGraphShape.java | 5 +- .../wala/cast/js/test/TestForInLoopHack.java | 6 +-- .../wala/cast/js/test/TestJQueryExamples.java | 3 +- .../cast/js/test/TestPointerAnalyses.java | 6 +-- .../js/test/TestPrototypeCallGraphShape.java | 3 +- .../js/test/TestSimplePageCallGraphShape.java | 39 ++++++++------- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../OptimisticCallgraphBuilder.java | 2 +- ...rklistBasedOptimisticCallgraphBuilder.java | 4 +- .../js/client/JavaScriptAnalysisEngine.java | 11 ++--- .../cast/js/html/DomLessSourceExtractor.java | 2 +- .../js/ipa/callgraph/JSCallGraphUtil.java | 2 +- .../correlations/CorrelationFinder.java | 11 ++--- .../CorrelatedPairExtractorFactory.java | 5 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../cast/ipa/callgraph/CAstAnalysisScope.java | 7 +-- .../cast/ipa/callgraph/CAstCallGraphUtil.java | 5 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../arraybounds/ArrayboundsAnalysisTest.java | 2 +- .../PruneArrayOutOfBoundExceptionEdge.java | 4 +- .../tests/callGraph/Java7CallGraphTest.java | 5 +- .../wala/core/tests/ir/AnnotationTest.java | 3 +- .../core/tests/ir/TypeAnnotationTest.java | 9 ++-- .../tests/shrike/DynamicCallGraphTest.java | 7 ++- .../shrike/DynamicCallGraphTestBase.java | 3 +- .../wala/core/tests/slicer/SlicerTest.java | 2 +- .../analysis/SimpleThreadEscapeAnalysis.java | 5 +- .../wala/examples/drivers/PDFCallGraph.java | 8 ++-- .../ibm/wala/examples/drivers/PDFSlice.java | 4 +- .../examples/drivers/PDFTypeHierarchy.java | 6 +-- .../.settings/org.eclipse.jdt.core.prefs | 4 +- .../ibm/wala/classLoader/ShrikeBTMethod.java | 16 ++----- .../wala/ipa/callgraph/cha/CHACallGraph.java | 2 +- .../propagation/PropagationSystem.java | 3 +- .../com/ibm/wala/ipa/cha/ClassHierarchy.java | 18 ++----- .../com/ibm/wala/util/io/FileProvider.java | 4 +- .../ibm/wala/util/scope/JUnitEntryPoints.java | 48 ++++++++----------- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../callGraph/DalvikCallGraphTestBase.java | 3 +- .../test/callGraph/DroidBenchCGTest.java | 3 +- .../DynamicDalvikComparisonJavaLibsTest.java | 6 +-- .../DynamicDalvikComparisonTest.java | 3 +- ...micDalvikComparisonTestForAndroidLibs.java | 5 +- .../callGraph/JVMLDalvikComparisonTest.java | 8 ++-- .../ibm/wala/cast/java/test/JDTJavaTest.java | 45 +++++++---------- .../client/JDTJavaSourceAnalysisEngine.java | 4 +- .../translator/jdt/JDTClassLoaderFactory.java | 3 +- .../translator/jdt/JDTSourceLoaderImpl.java | 6 +-- .../wala/ide/util/JavaEclipseProjectPath.java | 3 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../tests/AbstractJSProjectScopeTest.java | 5 +- .../EclipseJavaScriptAnalysisEngine.java | 2 +- .../js/client/EclipseWebAnalysisEngine.java | 2 +- .../wala/ide/util/EclipseWebProjectPath.java | 2 +- .../util/JavaScriptEclipseProjectPath.java | 3 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../examples/drivers/SWTTypeHierarchy.java | 7 ++- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../client/EclipseProjectAnalysisEngine.java | 2 +- .../EclipseProjectSourceAnalysisEngine.java | 6 +-- .../wala/ide/util/EclipseFileProvider.java | 2 +- .../ibm/wala/ide/util/EclipseProjectPath.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../ibm/wala/shrikeBT/analysis/Analyzer.java | 2 +- .../ibm/wala/shrikeBT/shrikeCT/CTDecoder.java | 24 ++-------- .../shrikeBT/shrikeCT/ClassInstrumenter.java | 2 +- .../shrikeCT/tools/BootstrapDumper.java | 5 +- .../shrikeCT/tools/BootstrapInstrumentor.java | 5 +- .../tools/OfflineInstrumenterBase.java | 2 +- .../ibm/wala/shrikeCT/ConstantPoolParser.java | 8 ++-- .../wala/shrikeCT/StackMapTableWriter.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../com/ibm/wala/util/processes/Launcher.java | 8 ++-- .../src/com/ibm/wala/viz/DotUtil.java | 4 +- 93 files changed, 246 insertions(+), 356 deletions(-) diff --git a/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/ecj/ECJClassLoaderFactory.java b/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/ecj/ECJClassLoaderFactory.java index 0203dbd66..1d5574b69 100644 --- a/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/ecj/ECJClassLoaderFactory.java +++ b/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/ecj/ECJClassLoaderFactory.java @@ -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); } diff --git a/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/ecj/ECJSourceLoaderImpl.java b/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/ecj/ECJSourceLoaderImpl.java index a93e57899..417f4aa7c 100644 --- a/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/ecj/ECJSourceLoaderImpl.java +++ b/com.ibm.wala.cast.java.ecj/src/com/ibm/wala/cast/java/translator/jdt/ecj/ECJSourceLoaderImpl.java @@ -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; } diff --git a/com.ibm.wala.cast.java.test/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.java.test/.settings/org.eclipse.jdt.core.prefs index e9c69822d..3bcb1f66c 100644 --- a/com.ibm.wala.cast.java.test/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.cast.java.test/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/IRTests.java b/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/IRTests.java index 197cdc3da..7eb3d147e 100644 --- a/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/IRTests.java +++ b/com.ibm.wala.cast.java.test/src/com/ibm/wala/cast/java/test/IRTests.java @@ -369,7 +369,7 @@ public abstract class IRTests { return Pair.make(callGraph, engine.getPointerAnalysis()); } - protected static void dumpIR(CallGraph cg, Collection sources, boolean assertReachable) throws IOException { + protected static void dumpIR(CallGraph cg, Collection sources, boolean assertReachable) { Set sourcePaths = HashSetFactory.make(); for(String src : sources) { sourcePaths.add(src.substring(src.lastIndexOf(File.separator)+1)); diff --git a/com.ibm.wala.cast.java/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.java/.settings/org.eclipse.jdt.core.prefs index 69afd9e4c..c83be671d 100644 --- a/com.ibm.wala.cast.java/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.cast.java/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/loader/JavaSourceLoaderImpl.java b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/loader/JavaSourceLoaderImpl.java index ed40b90b5..3e6a73045 100644 --- a/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/loader/JavaSourceLoaderImpl.java +++ b/com.ibm.wala.cast.java/src/com/ibm/wala/cast/java/loader/JavaSourceLoaderImpl.java @@ -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); } diff --git a/com.ibm.wala.cast.js.nodejs/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.nodejs/.settings/org.eclipse.jdt.core.prefs index 73640691b..8e95356f8 100644 --- a/com.ibm.wala.cast.js.nodejs/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.cast.js.nodejs/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsCallGraphBuilderUtil.java b/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsCallGraphBuilderUtil.java index 7caabef44..a5c47a820 100644 --- a/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsCallGraphBuilderUtil.java +++ b/com.ibm.wala.cast.js.nodejs/src/com/ibm/wala/cast/js/nodejs/NodejsCallGraphBuilderUtil.java @@ -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); diff --git a/com.ibm.wala.cast.js.rhino.test/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.rhino.test/.settings/org.eclipse.jdt.core.prefs index ddbb772ea..3c46997d2 100644 --- a/com.ibm.wala.cast.js.rhino.test/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.cast.js.rhino.test/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/AbstractFieldBasedTest.java b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/AbstractFieldBasedTest.java index df3fbb32a..8fad50813 100644 --- a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/AbstractFieldBasedTest.java +++ b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/AbstractFieldBasedTest.java @@ -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 { diff --git a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedComparisonTest.java b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedComparisonTest.java index a6bfff4c3..7e0d9fb9c 100644 --- a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedComparisonTest.java +++ b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedComparisonTest.java @@ -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); } diff --git a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/TestFieldBasedCG.java b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/TestFieldBasedCG.java index 00ef1c8a2..b50b5164f 100644 --- a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/TestFieldBasedCG.java +++ b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/TestFieldBasedCG.java @@ -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)); } diff --git a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/test/PrintIRs.java b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/test/PrintIRs.java index 091037b1c..e532b6be9 100644 --- a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/test/PrintIRs.java +++ b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/rhino/test/PrintIRs.java @@ -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 diff --git a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestRhinoSourceMap.java b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestRhinoSourceMap.java index db602142d..040ec114b 100644 --- a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestRhinoSourceMap.java +++ b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestRhinoSourceMap.java @@ -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); } diff --git a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShapeRhino.java b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShapeRhino.java index 77df985ed..41737640a 100644 --- a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShapeRhino.java +++ b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShapeRhino.java @@ -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()); diff --git a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShapeRhinoJericho.java b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShapeRhinoJericho.java index 1330ce736..4b2bf4c9c 100644 --- a/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShapeRhinoJericho.java +++ b/com.ibm.wala.cast.js.rhino.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShapeRhinoJericho.java @@ -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()); diff --git a/com.ibm.wala.cast.js.test/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.test/.settings/org.eclipse.jdt.core.prefs index 6453c1839..03f260c90 100644 --- a/com.ibm.wala.cast.js.test/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.cast.js.test/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/FieldBasedCGUtil.java b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/FieldBasedCGUtil.java index 8cdbc08bf..c062585b3 100644 --- a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/FieldBasedCGUtil.java +++ b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/FieldBasedCGUtil.java @@ -62,11 +62,11 @@ public class FieldBasedCGUtil { this.translatorFactory = translatorFactory; } - public Pair> buildCG(URL url, BuilderType builderType, boolean supportFullPointerAnalysis, Function fExtractor) throws IOException, WalaException, CancelException { + public Pair> buildCG(URL url, BuilderType builderType, boolean supportFullPointerAnalysis, Function fExtractor) throws WalaException, CancelException { return buildCG(url, builderType, new NullProgressMonitor(), supportFullPointerAnalysis, fExtractor); } - public Pair> buildCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis, Function fExtractor) throws IOException, WalaException, CancelException { + public Pair> buildCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis, Function 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> buildScriptCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws IOException, WalaException, CancelException { + public Pair> 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> buildPageCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis, Function fExtractor) throws IOException, WalaException, CancelException { + public Pair> buildPageCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis, Function 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> buildCG(JavaScriptLoaderFactory loaders, Module[] scripts, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws IOException, WalaException, CancelException { + public Pair> 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); diff --git a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/JSCallGraphBuilderUtil.java b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/JSCallGraphBuilderUtil.java index 4fbcec10a..c6bd53b13 100644 --- a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/JSCallGraphBuilderUtil.java +++ b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/JSCallGraphBuilderUtil.java @@ -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 irFactory) throws IOException, IllegalArgumentException, + public static CallGraph makeScriptCG(SourceModule[] scripts, CGBuilderType builderType, IRFactory 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 fExtractor) throws IOException, WalaException { + public static JSCFABuilder makeHTMLCGBuilder(URL url, Function fExtractor) throws WalaException { return makeHTMLCGBuilder(url, CGBuilderType.ZERO_ONE_CFA, fExtractor); } - public static JSCFABuilder makeHTMLCGBuilder(URL url, CGBuilderType builderType, Function fExtractor) throws IOException, WalaException { + public static JSCFABuilder makeHTMLCGBuilder(URL url, CGBuilderType builderType, Function fExtractor) throws WalaException { IRFactory 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 fExtractor) throws IOException, IllegalArgumentException, CancelException, WalaException { + public static CallGraph makeHTMLCG(URL url, Function 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 fExtractor) throws IOException, IllegalArgumentException, + public static CallGraph makeHTMLCG(URL url, CGBuilderType builderType, Function 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 irFactory) throws IOException, WalaException { + public static JSCFABuilder makeCGBuilder(JavaScriptLoaderFactory loaders, SourceModule[] scripts, CGBuilderType builderType, IRFactory 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 irFactory) throws IOException, WalaException { + protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, CGBuilderType builderType, IRFactory 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); } } diff --git a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestAjaxsltCallGraphShape.java b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestAjaxsltCallGraphShape.java index 1988921b9..ee0d98b16 100644 --- a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestAjaxsltCallGraphShape.java +++ b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestAjaxsltCallGraphShape.java @@ -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); diff --git a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestForInLoopHack.java b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestForInLoopHack.java index 6b686fa21..69504ab10 100644 --- a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestForInLoopHack.java +++ b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestForInLoopHack.java @@ -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); diff --git a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestJQueryExamples.java b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestJQueryExamples.java index 8b9c52846..ac25c0505 100644 --- a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestJQueryExamples.java +++ b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestJQueryExamples.java @@ -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()); diff --git a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPointerAnalyses.java b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPointerAnalyses.java index 82637efc2..7b4560bfb 100644 --- a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPointerAnalyses.java +++ b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPointerAnalyses.java @@ -162,7 +162,7 @@ public abstract class TestPointerAnalyses { return false; } - private void testPage(URL page, Predicate filter, Predicate>, Set>>> test) throws IOException, WalaException, CancelException { + private void testPage(URL page, Predicate filter, Predicate>, Set>>> 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")); } diff --git a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPrototypeCallGraphShape.java b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPrototypeCallGraphShape.java index 6aaec0c67..214fefaa6 100644 --- a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPrototypeCallGraphShape.java +++ b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestPrototypeCallGraphShape.java @@ -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); diff --git a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShape.java b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShape.java index d9d7431f0..d958662f0 100644 --- a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShape.java +++ b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimplePageCallGraphShape.java @@ -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); } diff --git a/com.ibm.wala.cast.js/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js/.settings/org.eclipse.jdt.core.prefs index 5bedee37e..2fe729927 100644 --- a/com.ibm.wala.cast.js/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.cast.js/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/OptimisticCallgraphBuilder.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/OptimisticCallgraphBuilder.java index c8ccea32e..00dd69ea5 100644 --- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/OptimisticCallgraphBuilder.java +++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/OptimisticCallgraphBuilder.java @@ -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(); diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/WorklistBasedOptimisticCallgraphBuilder.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/WorklistBasedOptimisticCallgraphBuilder.java index fdef71b50..121cc678a 100644 --- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/WorklistBasedOptimisticCallgraphBuilder.java +++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/callgraph/fieldbased/WorklistBasedOptimisticCallgraphBuilder.java @@ -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 worklist) throws CancelException { + private void addCallEdge(FlowGraph flowgraph, CallVertex c, FuncVertex callee, Set 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 worklist) throws CancelException { + private void addReflectiveCallEdge(FlowGraph flowgraph, VarVertex reflectiveCallee, JavaScriptInvoke invk, FuncVertex realCallee, Set worklist) { VertexFactory factory = flowgraph.getVertexFactory(); FuncVertex caller = reflectiveCallee.getFunction(); diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/JavaScriptAnalysisEngine.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/JavaScriptAnalysisEngine.java index c098f86e1..571d00b7d 100644 --- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/JavaScriptAnalysisEngine.java +++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/client/JavaScriptAnalysisEngine.java @@ -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 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 diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/html/DomLessSourceExtractor.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/html/DomLessSourceExtractor.java index 1593f8778..3ea06463a 100644 --- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/html/DomLessSourceExtractor.java +++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/html/DomLessSourceExtractor.java @@ -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); diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JSCallGraphUtil.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JSCallGraphUtil.java index da7d0ff85..53e957b61 100755 --- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JSCallGraphUtil.java +++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/JSCallGraphUtil.java @@ -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); diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/CorrelationFinder.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/CorrelationFinder.java index 455bc886e..9f3483d26 100644 --- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/CorrelationFinder.java +++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/CorrelationFinder.java @@ -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 findCorrelatedAccesses(URL url) throws IOException, ClassHierarchyException { + public Map findCorrelatedAccesses(URL url) throws ClassHierarchyException { Set scripts = null; if(url.getPath().endsWith(".js")) { scripts = Collections.singleton(new SourceURLModule(url)); @@ -278,13 +277,11 @@ public class CorrelationFinder { return summaries; } - public Map findCorrelatedAccesses(Collection scripts) throws IOException, - ClassHierarchyException { + public Map findCorrelatedAccesses(Collection scripts) throws ClassHierarchyException { return findCorrelatedAccesses(scripts.toArray(new SourceModule[scripts.size()])); } - public Map findCorrelatedAccesses(SourceModule[] scripts_array) throws IOException, - ClassHierarchyException { + public Map 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)); diff --git a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/CorrelatedPairExtractorFactory.java b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/CorrelatedPairExtractorFactory.java index e6614b8e1..5b00e80a9 100644 --- a/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/CorrelatedPairExtractorFactory.java +++ b/com.ibm.wala.cast.js/source/com/ibm/wala/cast/js/ipa/callgraph/correlations/extraction/CorrelatedPairExtractorFactory.java @@ -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 { private final Map 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)); } diff --git a/com.ibm.wala.cast/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast/.settings/org.eclipse.jdt.core.prefs index 9ce138485..88b0b5de8 100644 --- a/com.ibm.wala.cast/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.cast/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstAnalysisScope.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstAnalysisScope.java index e4fc761fb..89c69301c 100644 --- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstAnalysisScope.java +++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstAnalysisScope.java @@ -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 languages) - throws IOException { + public CAstAnalysisScope(String[] sourceFileNames, SingleClassLoaderFactory loaders, Collection 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 languages) - throws IOException { + public CAstAnalysisScope(Module[] sources, SingleClassLoaderFactory loaders, Collection languages) { this(loaders, languages); for (int i = 0; i < sources.length; i++) { addToScope(theLoader, sources[i]); diff --git a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstCallGraphUtil.java b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstCallGraphUtil.java index 7ed60f214..b80d9548a 100644 --- a/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstCallGraphUtil.java +++ b/com.ibm.wala.cast/source/java/com/ibm/wala/cast/ipa/callgraph/CAstCallGraphUtil.java @@ -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; } diff --git a/com.ibm.wala.core.tests/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.core.tests/.settings/org.eclipse.jdt.core.prefs index c522d4141..bd6446b48 100644 --- a/com.ibm.wala.core.tests/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.core.tests/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/ArrayboundsAnalysisTest.java b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/ArrayboundsAnalysisTest.java index 3230885ad..cccc5faa6 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/ArrayboundsAnalysisTest.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/ArrayboundsAnalysisTest.java @@ -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; diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/PruneArrayOutOfBoundExceptionEdge.java b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/PruneArrayOutOfBoundExceptionEdge.java index 5f01f221e..49e87130e 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/PruneArrayOutOfBoundExceptionEdge.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/arraybounds/PruneArrayOutOfBoundExceptionEdge.java @@ -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; diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/callGraph/Java7CallGraphTest.java b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/callGraph/Java7CallGraphTest.java index a0a7e455a..74ac67fb3 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/callGraph/Java7CallGraphTest.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/callGraph/Java7CallGraphTest.java @@ -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(); diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/ir/AnnotationTest.java b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/ir/AnnotationTest.java index 52f957f5a..a60177120 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/ir/AnnotationTest.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/ir/AnnotationTest.java @@ -89,8 +89,7 @@ public class AnnotationTest extends WalaTestCase { } private void testClassAnnotations(TypeReference typeUnderTest, Collection expectedRuntimeInvisibleAnnotations, - Collection expectedRuntimeVisibleAnnotations) throws IOException, ClassHierarchyException, - InvalidClassFileException { + Collection expectedRuntimeVisibleAnnotations) throws InvalidClassFileException { IClass classUnderTest = cha.lookupClass(typeUnderTest); harness.assertNotNull(typeUnderTest.toString() + " not found", classUnderTest); harness.assertTrue(classUnderTest + " must be BytecodeClass", classUnderTest instanceof BytecodeClass); diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/ir/TypeAnnotationTest.java b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/ir/TypeAnnotationTest.java index a3f702430..ce24822de 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/ir/TypeAnnotationTest.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/ir/TypeAnnotationTest.java @@ -252,8 +252,7 @@ public class TypeAnnotationTest extends WalaTestCase { } private void testClassAnnotations(TypeReference typeUnderTest, Collection expectedRuntimeInvisibleAnnotations, - Collection expectedRuntimeVisibleAnnotations) throws IOException, ClassHierarchyException, - InvalidClassFileException { + Collection 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 expectedRuntimeInvisibleAnnotations, - Collection expectedRuntimeVisibleAnnotations) throws IOException, ClassHierarchyException, - InvalidClassFileException { + Collection 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 expectedAnnotations) throws IOException, ClassHierarchyException, - InvalidClassFileException { + private void testFieldAnnotations(String fieldNameStr, TypeReference typeUnderTest, Collection expectedAnnotations) { IClass classUnderTest = cha.lookupClass(typeUnderTest); harness.assertNotNull(typeUnderTest.toString() + " not found", classUnderTest); harness.assertTrue(classUnderTest + " must be BytecodeClass", classUnderTest instanceof ShrikeClass); diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/shrike/DynamicCallGraphTest.java b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/shrike/DynamicCallGraphTest.java index 69a1ad403..cb5737c8d 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/shrike/DynamicCallGraphTest.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/shrike/DynamicCallGraphTest.java @@ -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"); diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/shrike/DynamicCallGraphTestBase.java b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/shrike/DynamicCallGraphTestBase.java index 34e824079..ecec05516 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/shrike/DynamicCallGraphTestBase.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/shrike/DynamicCallGraphTestBase.java @@ -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(); diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/slicer/SlicerTest.java b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/slicer/SlicerTest.java index 684d88a03..766be3150 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/slicer/SlicerTest.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/slicer/SlicerTest.java @@ -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); diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/SimpleThreadEscapeAnalysis.java b/com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/SimpleThreadEscapeAnalysis.java index d42f0967f..61dd498bf 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/SimpleThreadEscapeAnalysis.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/SimpleThreadEscapeAnalysis.java @@ -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 gatherThreadEscapingClasses() throws IOException, ClassHierarchyException, IllegalArgumentException, + public Set gatherThreadEscapingClasses() throws IOException, IllegalArgumentException, CancelException { // @@ -327,7 +326,7 @@ public class SimpleThreadEscapeAnalysis extends AbstractAnalysisEngine jars = HashSetFactory.make(); diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFCallGraph.java b/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFCallGraph.java index 43a042b8d..8d9f9696c 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFCallGraph.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFCallGraph.java @@ -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 result = HashSetFactory.make(); for (int i = 0; i < directories.length; i++) { for (Iterator 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 pruneForAppLoader(CallGraph g) throws WalaException { + public static Graph pruneForAppLoader(CallGraph g) { return PDFTypeHierarchy.pruneGraph(g, new ApplicationLoaderFilter()); } diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFSlice.java b/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFSlice.java index 43b8652f3..409b4b08a 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFSlice.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFSlice.java @@ -100,7 +100,7 @@ public class PDFSlice { * -dir argument tells whether to compute a forwards or backwards slice. * */ - 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 diff --git a/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFTypeHierarchy.java b/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFTypeHierarchy.java index 1a975c03f..4a30625e6 100644 --- a/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFTypeHierarchy.java +++ b/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFTypeHierarchy.java @@ -94,7 +94,7 @@ public class PDFTypeHierarchy { } } - public static Graph pruneGraph(Graph g, Predicate f) throws WalaException { + public static Graph pruneGraph(Graph g, Predicate f) { Collection 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 pruneForAppLoader(Graph g) throws WalaException { + public static Graph pruneForAppLoader(Graph g) { Predicate f = new Predicate() { @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 typeHierarchy2Graph(IClassHierarchy cha) throws WalaException { + public static Graph typeHierarchy2Graph(IClassHierarchy cha) { Graph result = SlowSparseNumberedGraph.make(); for (IClass c : cha) { result.addNode(c); diff --git a/com.ibm.wala.core/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.core/.settings/org.eclipse.jdt.core.prefs index 9ddb81676..3df951f72 100644 --- a/com.ibm.wala.core/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.core/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.core/src/com/ibm/wala/classLoader/ShrikeBTMethod.java b/com.ibm.wala.core/src/com/ibm/wala/classLoader/ShrikeBTMethod.java index 50b2899a2..e6b9a4027 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/classLoader/ShrikeBTMethod.java +++ b/com.ibm.wala.core/src/com/ibm/wala/classLoader/ShrikeBTMethod.java @@ -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); diff --git a/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/cha/CHACallGraph.java b/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/cha/CHACallGraph.java index 418ce878c..60aa39abf 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/cha/CHACallGraph.java +++ b/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/cha/CHACallGraph.java @@ -272,7 +272,7 @@ public class CHACallGraph extends BasicCallGraph { || 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); diff --git a/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/PropagationSystem.java b/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/PropagationSystem.java index 2e44aae76..274f71de6 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/PropagationSystem.java +++ b/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/PropagationSystem.java @@ -507,8 +507,7 @@ public class PropagationSystem extends DefaultFixedPointSolver 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 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 getSuperclasses(IClass c) throws ClassHierarchyException { + private static Set getSuperclasses(IClass c) { HashSet result = HashSetFactory.make(3); while (c.getSuperclass() != null) { result.add(c.getSuperclass()); diff --git a/com.ibm.wala.core/src/com/ibm/wala/util/io/FileProvider.java b/com.ibm.wala.core/src/com/ibm/wala/util/io/FileProvider.java index 20d1e9fbc..3aa94ac45 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/util/io/FileProvider.java +++ b/com.ibm.wala.core/src/com/ibm/wala/util/io/FileProvider.java @@ -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"); } diff --git a/com.ibm.wala.core/src/com/ibm/wala/util/scope/JUnitEntryPoints.java b/com.ibm.wala.core/src/com/ibm/wala/util/scope/JUnitEntryPoints.java index 8c6e10f6c..f391b27fa 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/util/scope/JUnitEntryPoints.java +++ b/com.ibm.wala.core/src/com/ibm/wala/util/scope/JUnitEntryPoints.java @@ -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 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 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 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() { @Override @@ -184,7 +176,7 @@ public class JUnitEntryPoints { /** * Get the "setUp" and "tearDown" methods in the given class */ - public static Set getSetUpTearDownMethods(IClass testClass) throws ClassHierarchyException { + public static Set getSetUpTearDownMethods(IClass testClass) { final Atom junitPackage = Atom.findOrCreateAsciiAtom("junit/framework"); final Atom junitClass = Atom.findOrCreateAsciiAtom("TestCase"); final Atom junitSuite = Atom.findOrCreateAsciiAtom("TestSuite"); diff --git a/com.ibm.wala.dalvik.test/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.dalvik.test/.settings/org.eclipse.jdt.core.prefs index aa2ea32c4..a10fd0af0 100644 --- a/com.ibm.wala.dalvik.test/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.dalvik.test/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DalvikCallGraphTestBase.java b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DalvikCallGraphTestBase.java index 107f9b425..d348bbd36 100644 --- a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DalvikCallGraphTestBase.java +++ b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DalvikCallGraphTestBase.java @@ -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); diff --git a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DroidBenchCGTest.java b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DroidBenchCGTest.java index ebb0632fd..73f16cb81 100644 --- a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DroidBenchCGTest.java +++ b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DroidBenchCGTest.java @@ -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 assertUserCodeReachable(CallGraph cg, Set uncalled) throws InvalidClassFileException { + public static Set assertUserCodeReachable(CallGraph cg, Set uncalled) { Set result = HashSetFactory.make(); for(Iterator clss = cg.getClassHierarchy().getLoader(ClassLoaderReference.Application).iterateAllClasses(); clss.hasNext(); ) diff --git a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonJavaLibsTest.java b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonJavaLibsTest.java index 9d1f83672..666658de9 100644 --- a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonJavaLibsTest.java +++ b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonJavaLibsTest.java @@ -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()); } diff --git a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonTest.java b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonTest.java index 8eb787314..fb7e8b8ae 100644 --- a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonTest.java +++ b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonTest.java @@ -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); diff --git a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonTestForAndroidLibs.java b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonTestForAndroidLibs.java index ac87bf9cf..0bdf459f1 100644 --- a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonTestForAndroidLibs.java +++ b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/DynamicDalvikComparisonTestForAndroidLibs.java @@ -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()); } diff --git a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/JVMLDalvikComparisonTest.java b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/JVMLDalvikComparisonTest.java index 2fc037868..55c07adaa 100644 --- a/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/JVMLDalvikComparisonTest.java +++ b/com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/test/callGraph/JVMLDalvikComparisonTest.java @@ -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> 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); } } diff --git a/com.ibm.wala.ide.jdt.test/source/com/ibm/wala/cast/java/test/JDTJavaTest.java b/com.ibm.wala.ide.jdt.test/source/com/ibm/wala/cast/java/test/JDTJavaTest.java index 37c436327..082a3e442 100644 --- a/com.ibm.wala.ide.jdt.test/source/com/ibm/wala/cast/java/test/JDTJavaTest.java +++ b/com.ibm.wala.ide.jdt.test/source/com/ibm/wala/cast/java/test/JDTJavaTest.java @@ -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 AbstractAnalysisEngine makeAnalysisEngine(final String[] mainClassDescriptors, Collection sources, List libs, ZippedProjectData project) { AbstractAnalysisEngine engine; - try { - engine = new JDTJavaSourceAnalysisEngine(project.projectName) { - { - setDump(Boolean.parseBoolean(System.getProperty("wala.cast.dump", "false"))); - } - - @Override - protected Iterable 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(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 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; } } diff --git a/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/client/JDTJavaSourceAnalysisEngine.java b/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/client/JDTJavaSourceAnalysisEngine.java index 4a1605a05..7c4dcc7b0 100644 --- a/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/client/JDTJavaSourceAnalysisEngine.java +++ b/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/client/JDTJavaSourceAnalysisEngine.java @@ -66,11 +66,11 @@ import com.ibm.wala.util.config.SetOfClasses; public class JDTJavaSourceAnalysisEngine extends EclipseProjectSourceAnalysisEngine { 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)); } diff --git a/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/translator/jdt/JDTClassLoaderFactory.java b/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/translator/jdt/JDTClassLoaderFactory.java index 9e3b34354..b7ec15826 100644 --- a/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/translator/jdt/JDTClassLoaderFactory.java +++ b/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/translator/jdt/JDTClassLoaderFactory.java @@ -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); } } diff --git a/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/translator/jdt/JDTSourceLoaderImpl.java b/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/translator/jdt/JDTSourceLoaderImpl.java index 7f4dfabdf..3e3d9de88 100644 --- a/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/translator/jdt/JDTSourceLoaderImpl.java +++ b/com.ibm.wala.ide.jdt/source/com/ibm/wala/cast/java/translator/jdt/JDTSourceLoaderImpl.java @@ -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; } diff --git a/com.ibm.wala.ide.jdt/source/com/ibm/wala/ide/util/JavaEclipseProjectPath.java b/com.ibm.wala.ide.jdt/source/com/ibm/wala/ide/util/JavaEclipseProjectPath.java index 1d8812bc7..86822cfec 100644 --- a/com.ibm.wala.ide.jdt/source/com/ibm/wala/ide/util/JavaEclipseProjectPath.java +++ b/com.ibm.wala.ide.jdt/source/com/ibm/wala/ide/util/JavaEclipseProjectPath.java @@ -47,8 +47,7 @@ public class JavaEclipseProjectPath extends EclipseProjectPath e = makeAnalysisEngine(p); JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory()); @@ -92,7 +91,7 @@ public abstract class AbstractJSProjectScopeTest { Assert.assertTrue(cha != null); } - protected EclipseJavaScriptAnalysisEngine makeAnalysisEngine(IJavaScriptProject p) throws IOException, CoreException { + protected EclipseJavaScriptAnalysisEngine makeAnalysisEngine(IJavaScriptProject p) { return new EclipseJavaScriptAnalysisEngine<>(p, BuilderType.REFLECTIVE); } diff --git a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/cast/js/client/EclipseJavaScriptAnalysisEngine.java b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/cast/js/client/EclipseJavaScriptAnalysisEngine.java index 462267db5..e56f8e935 100644 --- a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/cast/js/client/EclipseJavaScriptAnalysisEngine.java +++ b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/cast/js/client/EclipseJavaScriptAnalysisEngine.java @@ -65,7 +65,7 @@ public class EclipseJavaScriptAnalysisEngine 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; } diff --git a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/cast/js/client/EclipseWebAnalysisEngine.java b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/cast/js/client/EclipseWebAnalysisEngine.java index 5d61d500e..9d0197084 100644 --- a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/cast/js/client/EclipseWebAnalysisEngine.java +++ b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/cast/js/client/EclipseWebAnalysisEngine.java @@ -33,7 +33,7 @@ public class EclipseWebAnalysisEngine extends EclipseJavaScriptAnalysisEngine> models = HashSetFactory.make(); - public EclipseWebAnalysisEngine(IJavaScriptProject project, Collection> models, BuilderType builderType) throws IOException, CoreException { + public EclipseWebAnalysisEngine(IJavaScriptProject project, Collection> models, BuilderType builderType) { super(project, builderType); // core DOM model this.models.add(Pair.make("preamble.js", (Plugin)Activator.getDefault())); diff --git a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/EclipseWebProjectPath.java b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/EclipseWebProjectPath.java index 499f65154..92cef278a 100644 --- a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/EclipseWebProjectPath.java +++ b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/EclipseWebProjectPath.java @@ -24,7 +24,7 @@ import com.ibm.wala.util.collections.Pair; public class EclipseWebProjectPath extends JavaScriptEclipseProjectPath { - public EclipseWebProjectPath(Set> models) throws IOException, CoreException { + public EclipseWebProjectPath(Set> models) { super(models); } diff --git a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JavaScriptEclipseProjectPath.java b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JavaScriptEclipseProjectPath.java index d96ce6b5f..a163eec65 100644 --- a/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JavaScriptEclipseProjectPath.java +++ b/com.ibm.wala.ide.jsdt/source/com/ibm/wala/ide/util/JavaScriptEclipseProjectPath.java @@ -51,8 +51,7 @@ public class JavaScriptEclipseProjectPath extends EclipseProjectPath> models = HashSetFactory.make(); - protected JavaScriptEclipseProjectPath(Set> models) throws IOException, - CoreException { + protected JavaScriptEclipseProjectPath(Set> models) { super(AnalysisScopeType.SOURCE_FOR_PROJ_AND_LINKED_PROJS); this.models.addAll(models); this.models.add(Pair.make("prologue.js", (Plugin)Activator.getDefault())); diff --git a/com.ibm.wala.ide.tests/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.ide.tests/.settings/org.eclipse.jdt.core.prefs index 77d4ae9ac..6bd3dc3e0 100644 --- a/com.ibm.wala.ide.tests/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.ide.tests/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.ide.tests/src/com/ibm/wala/examples/drivers/SWTTypeHierarchy.java b/com.ibm.wala.ide.tests/src/com/ibm/wala/examples/drivers/SWTTypeHierarchy.java index fb8038799..8ab95db0c 100644 --- a/com.ibm.wala.ide.tests/src/com/ibm/wala/examples/drivers/SWTTypeHierarchy.java +++ b/com.ibm.wala.ide.tests/src/com/ibm/wala/examples/drivers/SWTTypeHierarchy.java @@ -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 typeHierarchy2Graph(IClassHierarchy cha) throws WalaException { + public static Graph typeHierarchy2Graph(IClassHierarchy cha) { Graph 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 pruneForAppLoader(Graph g) throws WalaException { + static Graph pruneForAppLoader(Graph g) { Predicate f = new Predicate() { @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 Graph pruneGraph(Graph g, Predicate f) throws WalaException { + public static Graph pruneGraph(Graph g, Predicate f) { Collection slice = GraphSlicer.slice(g, f); return GraphSlicer.prune(g, new CollectionFilter<>(slice)); } diff --git a/com.ibm.wala.ide/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.ide/.settings/org.eclipse.jdt.core.prefs index 1dcc16023..494b2f1e3 100644 --- a/com.ibm.wala.ide/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.ide/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.ide/src/com/ibm/wala/ide/client/EclipseProjectAnalysisEngine.java b/com.ibm.wala.ide/src/com/ibm/wala/ide/client/EclipseProjectAnalysisEngine.java index e3d8419bd..93dc8264f 100644 --- a/com.ibm.wala.ide/src/com/ibm/wala/ide/client/EclipseProjectAnalysisEngine.java +++ b/com.ibm.wala.ide/src/com/ibm/wala/ide/client/EclipseProjectAnalysisEngine.java @@ -38,7 +38,7 @@ abstract public class EclipseProjectAnalysisEngine ext protected EclipseProjectPath ePath; - public EclipseProjectAnalysisEngine(P project) throws IOException, CoreException { + public EclipseProjectAnalysisEngine(P project) { super(); this.project = project; this.workspaceRootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation(); diff --git a/com.ibm.wala.ide/src/com/ibm/wala/ide/client/EclipseProjectSourceAnalysisEngine.java b/com.ibm.wala.ide/src/com/ibm/wala/ide/client/EclipseProjectSourceAnalysisEngine.java index 9282db90c..d65572914 100644 --- a/com.ibm.wala.ide/src/com/ibm/wala/ide/client/EclipseProjectSourceAnalysisEngine.java +++ b/com.ibm.wala.ide/src/com/ibm/wala/ide/client/EclipseProjectSourceAnalysisEngine.java @@ -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 { */ 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); diff --git a/com.ibm.wala.shrike/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.shrike/.settings/org.eclipse.jdt.core.prefs index dcdb895a1..7d4d23051 100644 --- a/com.ibm.wala.shrike/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.shrike/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/analysis/Analyzer.java b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/analysis/Analyzer.java index eeb40a36c..7f9abdf12 100644 --- a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/analysis/Analyzer.java +++ b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/analysis/Analyzer.java @@ -562,7 +562,7 @@ public class Analyzer { return changed; } - private boolean mergeLocalTypes(int i, String[] curLocals, int curLocalsSize, List path) throws FailureException { + private boolean mergeLocalTypes(int i, String[] curLocals, int curLocalsSize, List path) { boolean changed = false; if (locals[i] == null) { diff --git a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/CTDecoder.java b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/CTDecoder.java index 6b3c24f2c..958a0abae 100644 --- a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/CTDecoder.java +++ b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/CTDecoder.java @@ -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 diff --git a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/ClassInstrumenter.java b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/ClassInstrumenter.java index 1e1d7186b..8dc9d5bba 100644 --- a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/ClassInstrumenter.java +++ b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/ClassInstrumenter.java @@ -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"); } diff --git a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/tools/BootstrapDumper.java b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/tools/BootstrapDumper.java index f3dc27c40..7f3d61af4 100644 --- a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/tools/BootstrapDumper.java +++ b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/tools/BootstrapDumper.java @@ -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"); } diff --git a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/tools/BootstrapInstrumentor.java b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/tools/BootstrapInstrumentor.java index 868ea300c..24f8c5ab3 100644 --- a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/tools/BootstrapInstrumentor.java +++ b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/shrikeCT/tools/BootstrapInstrumentor.java @@ -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 dumpAttributes(ClassInstrumenter ci, int i, ClassReader.AttrIterator attrs) throws InvalidClassFileException, - InvalidBytecodeException, IOException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException { + InvalidBytecodeException, SecurityException, IllegalArgumentException { Set 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 doClass(final ClassInstrumenter ci) throws InvalidClassFileException, InvalidBytecodeException, IOException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException { + public Set 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); diff --git a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/tools/OfflineInstrumenterBase.java b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/tools/OfflineInstrumenterBase.java index 2ee6dc493..6e77dda68 100644 --- a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/tools/OfflineInstrumenterBase.java +++ b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeBT/tools/OfflineInstrumenterBase.java @@ -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)); } diff --git a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/ConstantPoolParser.java b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/ConstantPoolParser.java index 3b89e320a..9bd9d75e9 100644 --- a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/ConstantPoolParser.java +++ b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/ConstantPoolParser.java @@ -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"); } diff --git a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/StackMapTableWriter.java b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/StackMapTableWriter.java index 3cb91a2a8..c67849350 100644 --- a/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/StackMapTableWriter.java +++ b/com.ibm.wala.shrike/src/com/ibm/wala/shrikeCT/StackMapTableWriter.java @@ -197,7 +197,7 @@ public class StackMapTableWriter extends Element { return false; } - public static List stackMapTable(ClassWriter writer, MethodData method, Output output, ClassHierarchyProvider cha, String[][] vars, List reuseFrames) throws FailureException, IOException { + public static List stackMapTable(ClassWriter writer, MethodData method, Output output, ClassHierarchyProvider cha, String[][] vars, List reuseFrames) throws FailureException { int idx = 0; List frames = new ArrayList<>(); diff --git a/com.ibm.wala.util/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.util/.settings/org.eclipse.jdt.core.prefs index 93b5cb5c2..06d4da0f2 100644 --- a/com.ibm.wala.util/.settings/org.eclipse.jdt.core.prefs +++ b/com.ibm.wala.util/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/com.ibm.wala.util/src/com/ibm/wala/util/processes/Launcher.java b/com.ibm.wala.util/src/com/ibm/wala/util/processes/Launcher.java index 11821f421..f60b94d53 100644 --- a/com.ibm.wala.util/src/com/ibm/wala/util/processes/Launcher.java +++ b/com.ibm.wala.util/src/com/ibm/wala/util/processes/Launcher.java @@ -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) { diff --git a/com.ibm.wala.util/src/com/ibm/wala/viz/DotUtil.java b/com.ibm.wala.util/src/com/ibm/wala/viz/DotUtil.java index dcc270244..f7f022533 100644 --- a/com.ibm.wala.util/src/com/ibm/wala/viz/DotUtil.java +++ b/com.ibm.wala.util/src/com/ibm/wala/viz/DotUtil.java @@ -248,11 +248,11 @@ public class DotUtil { /** * Compute the nodes to visualize */ - private static Collection computeDotNodes(Graph g) throws WalaException { + private static Collection computeDotNodes(Graph g) { return Iterator2Collection.toSet(g.iterator()); } - private static String getRankDir() throws WalaException { + private static String getRankDir() { return null; }