Skip to content

Commit c9fdc91

Browse files
authored
Remove duplicate or redundant throws declarations (#1864)
Also, enable the corresponding IntelliJ IDEA inspection to catch similar issues in the future.
1 parent f92a862 commit c9fdc91

File tree

24 files changed

+65
-88
lines changed

24 files changed

+65
-88
lines changed

.idea/inspectionProfiles/No_Back_Sliding.xml

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cast/js/rhino/src/main/java/com/ibm/wala/cast/js/translator/RhinoToAstTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2727,7 +2727,7 @@ private CAstNode makeVarRef(String varName) {
27272727
/** parse the JavaScript code using Rhino, and then translate the resulting AST to CAst */
27282728
@Override
27292729
public CAstEntity translateToCAst()
2730-
throws Error, IOException, com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error {
2730+
throws IOException, com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error {
27312731
class CAstErrorReporter implements ErrorReporter {
27322732
private final Set<Warning> w = HashSetFactory.make();
27332733

cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/AbstractFieldBasedTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test;
22

3-
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error;
43
import com.ibm.wala.cast.js.html.DefaultSourceExtractor;
54
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraph;
65
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil;
@@ -35,14 +34,14 @@ public void setUp() throws Exception {
3534

3635
protected JSCallGraph runTest(
3736
String script, List<GraphAssertion> assertions, BuilderType... builderTypes)
38-
throws WalaException, Error, CancelException {
37+
throws WalaException, CancelException {
3938
return runTest(
4039
TestFieldBasedCG.class.getClassLoader().getResource(script), assertions, builderTypes);
4140
}
4241

4342
protected JSCallGraph runTest(
4443
URL url, List<GraphAssertion> assertions, BuilderType... builderTypes)
45-
throws WalaException, Error, CancelException {
44+
throws WalaException, CancelException {
4645
JSCallGraph cg = null;
4746
for (BuilderType builderType : builderTypes) {
4847
IProgressMonitor monitor = ProgressMaster.make(new NullProgressMonitor(), 45000, true);
@@ -60,7 +59,7 @@ protected JSCallGraph runTest(
6059

6160
protected JSCallGraph runBoundedTest(
6261
String script, List<GraphAssertion> assertions, BuilderType builderType, int bound)
63-
throws WalaException, Error, CancelException {
62+
throws WalaException, CancelException {
6463
final JSCallGraph cg;
6564
JavaScriptLoaderFactory loaders = new JavaScriptLoaderFactory(new CAstRhinoTranslatorFactory());
6665
IProgressMonitor monitor = ProgressMaster.make(new NullProgressMonitor(), 45000, true);

cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedCGGamesTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test;
22

3-
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error;
43
import com.ibm.wala.cast.js.util.FieldBasedCGUtil.BuilderType;
54
import com.ibm.wala.util.CancelException;
65
import com.ibm.wala.util.WalaException;
@@ -18,7 +17,7 @@
1817
public class FieldBasedCGGamesTest extends AbstractFieldBasedTest {
1918

2019
@Test
21-
public void testBunnyHunt() throws IOException, WalaException, Error, CancelException {
20+
public void testBunnyHunt() throws IOException, WalaException, CancelException {
2221
URL url = getUrl("http://www.themaninblue.com/experiment/BunnyHunt/");
2322
runTest(url, List.of(), BuilderType.OPTIMISTIC);
2423
}
@@ -33,21 +32,21 @@ private static URL getUrl(String urlStr) throws MalformedURLException {
3332

3433
@Disabled("seems to break with http issues")
3534
@Test
36-
public void testBeslimed() throws IOException, WalaException, Error, CancelException {
35+
public void testBeslimed() throws IOException, WalaException, CancelException {
3736
URL url = getUrl("http://www.markus-inger.de/test/game.php");
3837
runTest(url, List.of(), BuilderType.OPTIMISTIC);
3938
}
4039

4140
@Disabled("seems to break with http issues")
4241
@Test
43-
public void testDiggAttack() throws IOException, WalaException, Error, CancelException {
42+
public void testDiggAttack() throws IOException, WalaException, CancelException {
4443
URL url = getUrl("http://www.pixastic.com/labs/digg_attack/");
4544
runTest(url, List.of(), BuilderType.OPTIMISTIC);
4645
}
4746

4847
@Disabled
4948
@Test
50-
public void testRiverRaider() throws IOException, WalaException, Error, CancelException {
49+
public void testRiverRaider() throws IOException, WalaException, CancelException {
5150
URL url =
5251
getUrl(
5352
"http://playstar.mobi/games/riverraider/index.html?playerId=&gameId=8&highscore=102425");
@@ -56,31 +55,31 @@ public void testRiverRaider() throws IOException, WalaException, Error, CancelEx
5655

5756
@Disabled("fails with \"timed out\" CancelException")
5857
@Test
59-
public void testSolitaire() throws IOException, WalaException, Error, CancelException {
58+
public void testSolitaire() throws IOException, WalaException, CancelException {
6059
URL url = getUrl("http://www.inmensia.com/files/solitaire1.0.html");
6160
runTest(url, List.of(), BuilderType.OPTIMISTIC);
6261
}
6362

6463
@Test // (expected = CancelException.class)
65-
public void testWorldOfSolitaire() throws IOException, WalaException, Error, CancelException {
64+
public void testWorldOfSolitaire() throws IOException, WalaException, CancelException {
6665
URL url = getUrl("http://worldofsolitaire.com/");
6766
runTest(url, List.of(), BuilderType.OPTIMISTIC);
6867
}
6968

7069
@Test
71-
public void testMinesweeper() throws IOException, WalaException, Error, CancelException {
70+
public void testMinesweeper() throws IOException, WalaException, CancelException {
7271
URL url = getUrl("http://www.inmensia.com/files/minesweeper1.0.html");
7372
runTest(url, List.of(), BuilderType.OPTIMISTIC_WORKLIST);
7473
}
7574

7675
@Test
77-
public void testProtoRPG() throws IOException, WalaException, Error, CancelException {
76+
public void testProtoRPG() throws IOException, WalaException, CancelException {
7877
URL url = getUrl("http://www.protorpg.com/games/protorpg/?game=prologue");
7978
runTest(url, List.of(), BuilderType.OPTIMISTIC_WORKLIST);
8079
}
8180

8281
@Test
83-
public void testBattleship() throws IOException, WalaException, Error, CancelException {
82+
public void testBattleship() throws IOException, WalaException, CancelException {
8483
URL url = getUrl("http://www.sinkmyship.com/battleship/single.html");
8584
runTest(url, List.of(), BuilderType.OPTIMISTIC_WORKLIST);
8685
}

cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedComparisonTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
44

5-
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error;
65
import com.ibm.wala.cast.js.test.ExtractingToPredictableFileNames;
76
import com.ibm.wala.cast.js.test.TestSimplePageCallGraphShape;
87
import com.ibm.wala.cast.js.util.FieldBasedCGUtil.BuilderType;
@@ -14,7 +13,7 @@
1413
public class FieldBasedComparisonTest extends AbstractFieldBasedTest {
1514

1615
private void test(String file, List<GraphAssertion> assertions, BuilderType builderType)
17-
throws WalaException, Error, CancelException {
16+
throws WalaException, CancelException {
1817
try (ExtractingToPredictableFileNames predictable = new ExtractingToPredictableFileNames()) {
1918
runTest(file, assertions, builderType);
2019
}
@@ -32,15 +31,15 @@ public void testSkeletonPessimistic() {
3231
}
3332

3433
@Test
35-
public void testSkeletonOptimistic() throws WalaException, Error, CancelException {
34+
public void testSkeletonOptimistic() throws WalaException, CancelException {
3635
test(
3736
"pages/skeleton.html",
3837
TestSimplePageCallGraphShape.assertionsForSkeleton,
3938
BuilderType.OPTIMISTIC);
4039
}
4140

4241
@Test
43-
public void testSkeletonWorklist() throws WalaException, Error, CancelException {
42+
public void testSkeletonWorklist() throws WalaException, CancelException {
4443
test(
4544
"pages/skeleton.html",
4645
TestSimplePageCallGraphShape.assertionsForSkeleton,
@@ -59,15 +58,15 @@ public void testSkeleton2Pessimistic() {
5958
}
6059

6160
@Test
62-
public void testSkeleton2Optimistic() throws WalaException, Error, CancelException {
61+
public void testSkeleton2Optimistic() throws WalaException, CancelException {
6362
test(
6463
"pages/skeleton2.html",
6564
TestSimplePageCallGraphShape.assertionsForSkeleton2,
6665
BuilderType.OPTIMISTIC);
6766
}
6867

6968
@Test
70-
public void testSkeleton2Worklist() throws WalaException, Error, CancelException {
69+
public void testSkeleton2Worklist() throws WalaException, CancelException {
7170
test(
7271
"pages/skeleton2.html",
7372
TestSimplePageCallGraphShape.assertionsForSkeleton2,

cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/FieldBasedJQueryTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test;
22

3-
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error;
43
import com.ibm.wala.cast.js.util.FieldBasedCGUtil.BuilderType;
54
import com.ibm.wala.util.CancelException;
65
import com.ibm.wala.util.WalaException;
@@ -15,8 +14,7 @@
1514
public class FieldBasedJQueryTest extends AbstractFieldBasedTest {
1615

1716
@Test
18-
public void test1_8_2()
19-
throws IOException, WalaException, Error, CancelException, URISyntaxException {
17+
public void test1_8_2() throws IOException, WalaException, CancelException, URISyntaxException {
2018
runTest(
2119
new URI("http://code.jquery.com/jquery-1.8.2.js").toURL(),
2220
List.of(),

cast/js/rhino/src/test/java/com/ibm/wala/cast/js/rhino/callgraph/fieldbased/test/TestBoundedFieldBasedCG.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111
package com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test;
1212

13-
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error;
1413
import com.ibm.wala.cast.js.util.FieldBasedCGUtil.BuilderType;
1514
import com.ibm.wala.util.CancelException;
1615
import com.ibm.wala.util.WalaException;
@@ -26,7 +25,7 @@ public class TestBoundedFieldBasedCG extends AbstractFieldBasedTest {
2625
new GraphAssertion("suffix:call", new String[] {"!suffix:m"}));
2726

2827
@Test
29-
public void testBound0Worklist() throws WalaException, Error, CancelException {
28+
public void testBound0Worklist() throws WalaException, CancelException {
3029
runBoundedTest(
3130
"tests/field-based/bounded.js", assertionsForBound0JS, BuilderType.OPTIMISTIC_WORKLIST, 0);
3231
}
@@ -39,7 +38,7 @@ public void testBound0Worklist() throws WalaException, Error, CancelException {
3938
new GraphAssertion("suffix:call", new String[] {"!suffix:m"}));
4039

4140
@Test
42-
public void testBound1Worklist() throws WalaException, Error, CancelException {
41+
public void testBound1Worklist() throws WalaException, CancelException {
4342
runBoundedTest(
4443
"tests/field-based/bounded.js", assertionsForBound1JS, BuilderType.OPTIMISTIC_WORKLIST, 1);
4544
}
@@ -52,7 +51,7 @@ public void testBound1Worklist() throws WalaException, Error, CancelException {
5251
new GraphAssertion("suffix:call", new String[] {"suffix:m"}));
5352

5453
@Test
55-
public void testBound2Worklist() throws WalaException, Error, CancelException {
54+
public void testBound2Worklist() throws WalaException, CancelException {
5655
runBoundedTest(
5756
"tests/field-based/bounded.js", assertionsForBound2JS, BuilderType.OPTIMISTIC_WORKLIST, 2);
5857
}

0 commit comments

Comments
 (0)