Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix more unused exceptions #2306

Merged
merged 1 commit into from
Jul 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/test/java/spoon/processing/CtGenerationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testGenerateReplacementVisitor() throws Exception {
}

@Test
public void testGenerateCtBiScanner() throws Exception {
public void testGenerateCtBiScanner() {
// contract: generates the biscanner that is used for equality checking
final Launcher launcher = new Launcher();
launcher.getEnvironment().setNoClasspath(true);
Expand Down Expand Up @@ -111,7 +111,7 @@ public void testGenerateCtBiScanner() throws Exception {
}

@Test
public void testGenerateCloneVisitor() throws Exception {
public void testGenerateCloneVisitor() {
// contract: generates CloneBuilder.java and CloneBuilder.java
final Launcher launcher = new Launcher();
launcher.getEnvironment().setNoClasspath(true);
Expand Down Expand Up @@ -159,7 +159,7 @@ public void testGenerateCloneVisitor() throws Exception {
}

@Test
public void testGenerateRoleHandler() throws Exception {
public void testGenerateRoleHandler() {
final Launcher launcher = new Launcher();
launcher.getEnvironment().setAutoImports(true);
launcher.getEnvironment().setNoClasspath(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void testGetAllMethodsReturnsTheRightNumber() {
}

@Test
public void testGetSuperclass() throws Exception {
public void testGetSuperclass() {
final CtType<?> extendsArrayList = this.factory.Type().get(ExtendsArrayList.class);

// only 1 method directly in this class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public class CtInheritanceScannerMethodsTest {

@Test
public void testMethodsInInheritanceScanner() throws Exception {
public void testMethodsInInheritanceScanner() {
// contract: CtInheritanceScanner must declare all scanner and visitor methods.
final Launcher launcher = new Launcher();
launcher.setArgs(new String[] {"--output-type", "nooutput" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static Collection<Object[]> data() throws Exception {
* @return
* @throws Exception
*/
private List<Method> getMethodToInvoke(Class<?> entry) throws Exception {
private List<Method> getMethodToInvoke(Class<?> entry) {
Queue<Class<?>> tocheck = new LinkedList<>();
tocheck.add(entry);

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/reflect/visitor/CtIteratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class CtIteratorTest {

@Test
public void testCtElementIteration() throws Exception {
public void testCtElementIteration() {
// contract: CtIterator must go over all nodes in dfs order
final Launcher launcher = new Launcher();
launcher.setArgs(new String[]{"--output-type", "nooutput"});
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/spoon/reflect/visitor/CtScannerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
public class CtScannerTest {

@Test
public void testScannerContract() throws Exception {
public void testScannerContract() {
// contract: CtScanner must call enter and exit methods in each visit methods.
final Launcher launcher = new Launcher();
launcher.setArgs(new String[] {"--output-type", "nooutput" });
Expand Down Expand Up @@ -112,7 +112,7 @@ private String computeSimpleSignature(CtMethod<?> m) {
}

@Test
public void testScannerCallsAllProperties() throws Exception {
public void testScannerCallsAllProperties() {
// contract: CtScanner must visit all metamodel properties and use correct CtRole!
final Launcher launcher = new Launcher();
launcher.addInputResource("./src/main/java/spoon/reflect/");
Expand Down Expand Up @@ -220,7 +220,7 @@ public boolean matches(CtInvocation element) {
}

@Test
public void testScan() throws Exception {
public void testScan() {
// contract: all AST nodes are visisted through method "scan"
Launcher launcher;
launcher = new Launcher();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/reflect/visitor/CtVisitorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public class CtVisitorTest {

@Test
public void testMethodsInVisitor() throws Exception {
public void testMethodsInVisitor() {
// contract: CtVisitor must declare all visit methods.
final Launcher launcher = new Launcher();
launcher.setArgs(new String[] {"--output-type", "nooutput" });
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/test/ctType/CtTypeParameterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void checkTypeParamErasureOfType(CtTypeParameter typeParam, Class<?> cla
assertEquals("TypeErasure of type param "+getTypeParamIdentification(typeParam), field.getType().getName(), typeParam.getTypeErasure().getQualifiedName());
}

private void checkTypeParamErasureOfExecutable(CtTypeParameter typeParam) throws NoSuchFieldException, SecurityException {
private void checkTypeParamErasureOfExecutable(CtTypeParameter typeParam) throws SecurityException {
CtExecutable<?> exec = (CtExecutable<?>) typeParam.getParent();
CtParameter<?> param = exec.filterChildren(new NamedElementFilter<>(CtParameter.class,"param"+typeParam.getSimpleName())).first();
assertNotNull("Missing param"+typeParam.getSimpleName() + " in "+ exec.getSignature(), param);
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/spoon/test/ctType/CtTypeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testHasMethodOnNull() {
}

@Test
public void testHasMethodInSuperClass() throws Exception {
public void testHasMethodInSuperClass() {
final Launcher launcher = new Launcher();
launcher.addInputResource("./src/test/java/spoon/test/ctType/testclasses/X.java");
launcher.run();
Expand All @@ -69,7 +69,7 @@ public void testHasMethodInSuperClass() throws Exception {
}

@Test
public void testHasMethodInDefaultMethod() throws Exception {
public void testHasMethodInDefaultMethod() {
final Launcher launcher = new Launcher();
launcher.addInputResource("./src/test/java/spoon/test/ctType/testclasses/X.java");
launcher.getEnvironment().setComplianceLevel(8);
Expand Down Expand Up @@ -135,7 +135,7 @@ public void testIsSubTypeOfonTypeParameters() throws Exception {
}

@Test
public void testIsSubTypeOfonTypeReferences() throws Exception {
public void testIsSubTypeOfonTypeReferences() {
final Launcher launcher = new Launcher();
launcher.setArgs(new String[]{"-c"});
launcher.addInputResource("./src/test/java/spoon/test/ctType/testclasses/SubtypeModel.java");
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/test/enums/EnumsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void testModelBuildingEnum() throws Exception {
}

@Test
public void testAnnotationsOnEnum() throws Exception {
public void testAnnotationsOnEnum() {
final Launcher launcher = new Launcher();
launcher.run(new String[] {
"-i", "./src/test/java/spoon/test/enums/testclasses",
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/spoon/test/eval/EvalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void testDoNotSimplifyToExpressionWhenStatementIsExpected() throws Except
}

@Test
public void testVisitorPartialEvaluator_binary() throws Exception {
public void testVisitorPartialEvaluator_binary() {
Launcher launcher = new Launcher();

{ // binary operator
Expand Down Expand Up @@ -144,7 +144,7 @@ public void testVisitorPartialEvaluator_binary() throws Exception {
}

@Test
public void testVisitorPartialEvaluator_if() throws Exception {
public void testVisitorPartialEvaluator_if() {
Launcher launcher = new Launcher();
{ // the untaken branch is removed
CtCodeElement el = launcher.getFactory().Code().createCodeSnippetStatement("if (false) {System.out.println(\"foo\");} else {System.out.println(\"bar\");} ").compile();
Expand All @@ -158,7 +158,7 @@ public void testVisitorPartialEvaluator_if() throws Exception {
}

@Test
public void testVisitorPartialEvaluatorScanner() throws Exception {
public void testVisitorPartialEvaluatorScanner() {
Launcher launcher = new Launcher();
launcher.addInputResource("src/test/java/spoon/test/eval/testclasses/Foo.java");
launcher.buildModel();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/test/executable/ExecutableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

public class ExecutableTest {
@Test
public void testInfoInsideAnonymousExecutable() throws Exception {
public void testInfoInsideAnonymousExecutable() {
final Launcher launcher = new Launcher();
launcher.setArgs(new String[] {"--output-type", "nooutput" });
launcher.addInputResource("./src/test/java/spoon/test/executable/testclasses/AnonymousExecutableSample.java");
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/spoon/test/factory/FactoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void testClassAccessCreatedFromFactories() throws Exception {
}

@Test
public void testCtModel() throws Exception {
public void testCtModel() {
SpoonAPI spoon = new Launcher();
spoon.addInputResource("src/test/java/spoon/test/factory/testclasses");
spoon.buildModel();
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/spoon/test/field/FieldTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
public class FieldTest {

@Test
public void testAddAFieldInAClassAtAPositionGiven() throws Exception {
public void testAddAFieldInAClassAtAPositionGiven() {
final Factory factory = createFactory();
final CtClass<Object> fieldClass = factory.Class().create("FieldClass");

Expand Down Expand Up @@ -127,7 +127,7 @@ private CtField<Integer> createField(Factory factory, HashSet<ModifierKind> modi
}

@Test
public void testGetDefaultExpression() throws Exception {
public void testGetDefaultExpression() {
Launcher spoon = new Launcher();
spoon.addInputResource("./src/test/java/spoon/test/field/testclasses/A.java");
spoon.addInputResource("./src/test/java/spoon/test/field/testclasses/BaseClass.java");
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/spoon/test/fieldaccesses/FieldAccessTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void testFieldAccessInAnonymousClass() throws Exception {


@Test
public void testFieldAccessNoClasspath() throws Exception {
public void testFieldAccessNoClasspath() {
Launcher launcher = new Launcher();
launcher.addInputResource("src/test/resources/import-resources/fr/inria/");
launcher.getEnvironment().setNoClasspath(true);
Expand Down Expand Up @@ -292,7 +292,7 @@ public void testTypeDeclaredInAnonymousClass() throws Exception {
}

@Test
public void testFieldAccessDeclaredInADefaultClass() throws Exception {
public void testFieldAccessDeclaredInADefaultClass() {
final Launcher launcher = new Launcher();
launcher.setArgs(new String[] {"--output-type", "nooutput" });
launcher.addInputResource("./src/test/java/spoon/test/fieldaccesses/testclasses/Tacos.java");
Expand Down Expand Up @@ -344,7 +344,7 @@ public void testTypeOfFieldAccess() throws Exception {
}

@Test
public void testFieldAccessWithoutAnyImport() throws Exception {
public void testFieldAccessWithoutAnyImport() {
final Launcher launcher = new Launcher();
launcher.setArgs(new String[] {"--output-type", "nooutput" });
launcher.addInputResource("./src/test/java/spoon/test/fieldaccesses/testclasses/Kuu.java");
Expand All @@ -358,7 +358,7 @@ public void testFieldAccessWithoutAnyImport() throws Exception {
}

@Test
public void testFieldAccessOnUnknownType() throws Exception {
public void testFieldAccessOnUnknownType() {
final Launcher launcher = new Launcher();

launcher.addInputResource("./src/test/resources/noclasspath/FieldAccessRes.java");
Expand All @@ -384,7 +384,7 @@ public <T> void visitCtFieldWrite(CtFieldWrite<T> fieldWrite) {
}

@Test
public void testGetReference() throws Exception {
public void testGetReference() {
final Launcher launcher = new Launcher();
launcher.getEnvironment().setShouldCompile(true);
launcher.setArgs(new String[] {"--output-type", "nooutput" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void superInvocationWithEnclosingInstance() throws Exception {
}

@Test
public void testPrintAClassWithImports() throws Exception {
public void testPrintAClassWithImports() {
final Launcher launcher = new Launcher();
final Factory factory = launcher.getFactory();
factory.getEnvironment().setAutoImports(true);
Expand Down Expand Up @@ -114,7 +114,7 @@ public void testPrintAClassWithImports() throws Exception {
}

@Test
public void testPrintAMethodWithImports() throws Exception {
public void testPrintAMethodWithImports() {
final Launcher launcher = new Launcher();
final Factory factory = launcher.getFactory();
factory.getEnvironment().setAutoImports(true);
Expand All @@ -141,7 +141,7 @@ public void testPrintAMethodWithImports() throws Exception {
}

@Test
public void testPrintAMethodWithGeneric() throws Exception {
public void testPrintAMethodWithGeneric() {
final Launcher launcher = new Launcher();
final Factory factory = launcher.getFactory();
factory.getEnvironment().setAutoImports(true);
Expand All @@ -166,7 +166,7 @@ public void testPrintAMethodWithGeneric() throws Exception {
}

@Test
public void autoImportUsesFullyQualifiedNameWhenImportedNameAlreadyPresent() throws Exception {
public void autoImportUsesFullyQualifiedNameWhenImportedNameAlreadyPresent() {
final Launcher launcher = new Launcher();
final Factory factory = launcher.getFactory();
factory.getEnvironment().setAutoImports(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void setUp() throws Exception {
}

@Test
public void testReferencesBetweenConstructors() throws Exception {
public void testReferencesBetweenConstructors() {
final List<CtConstructor<?>> constructors = getConstructorsByClass("MyClass");

CtConstructor<?> emptyConstructor = constructors.get(0);
Expand All @@ -70,7 +70,7 @@ public void testReferencesBetweenConstructors() throws Exception {
}

@Test
public void testReferencesBetweenConstructorsInOtherClass() throws Exception {
public void testReferencesBetweenConstructorsInOtherClass() {
final List<CtConstructor<?>> constructors = getConstructorsByClass("MyClass2");
final CtConstructor<?> ctConstructor = constructors.get(0);
final List<CtExecutableReference<?>> refConstructors = getCtConstructorsReferencedInCtConstructor(ctConstructor);
Expand All @@ -94,7 +94,7 @@ public void testReferencesBetweenConstructorsInOtherClass() throws Exception {
}

@Test
public void testOneReferenceBetweenMethodsInSameClass() throws Exception {
public void testOneReferenceBetweenMethodsInSameClass() {
final CtClass<?> clazz = getCtClassByName("MyClass");

CtMethod<?> method1 = getCtMethodByNameFromCtClass(clazz, "method1");
Expand All @@ -106,7 +106,7 @@ public void testOneReferenceBetweenMethodsInSameClass() throws Exception {
}

@Test
public void testMultiReferenceBetweenMethodsWithGenericInSameClass() throws Exception {
public void testMultiReferenceBetweenMethodsWithGenericInSameClass() {
final CtClass<?> clazz = getCtClassByName("MyClass");

CtMethod<?> method2 = getCtMethodByNameFromCtClass(clazz, "method2");
Expand All @@ -125,7 +125,7 @@ public void testMultiReferenceBetweenMethodsWithGenericInSameClass() throws Exce
}

@Test
public void testMultiReferencesBetweenMethodsWithoutGenericInSameClass() throws Exception {
public void testMultiReferencesBetweenMethodsWithoutGenericInSameClass() {
final CtClass<?> clazz = getCtClassByName("MyClass");

CtMethod<?> method3 = getCtMethodByNameFromCtClass(clazz, "method3");
Expand All @@ -139,7 +139,7 @@ public void testMultiReferencesBetweenMethodsWithoutGenericInSameClass() throws
}

@Test
public void testMethodWithoutReferences() throws Exception {
public void testMethodWithoutReferences() {
final CtClass<?> clazz = getCtClassByName("MyClass");

CtMethod<?> method4 = getCtMethodByNameFromCtClass(clazz, "method4");
Expand All @@ -149,7 +149,7 @@ public void testMethodWithoutReferences() throws Exception {
}

@Test
public void testMethodGenericWithoutReferences() throws Exception {
public void testMethodGenericWithoutReferences() {
final CtClass<?> clazz = getCtClassByName("MyClass");

CtMethod<?> method5 = getCtMethodByNameFromCtClass(clazz, "method5");
Expand All @@ -159,7 +159,7 @@ public void testMethodGenericWithoutReferences() throws Exception {
}

@Test
public void testOneReferenceWithGenericMethodOutOfTheClass() throws Exception {
public void testOneReferenceWithGenericMethodOutOfTheClass() {
final CtClass<?> clazz = getCtClassByName("MyClass");
final CtClass<?> clazz2 = getCtClassByName("MyClass2");

Expand All @@ -176,7 +176,7 @@ public void testOneReferenceWithGenericMethodOutOfTheClass() throws Exception {
}

@Test
public void testOneReferenceWithMethodNotGenericOutOfTheClass() throws Exception {
public void testOneReferenceWithMethodNotGenericOutOfTheClass() {
final CtClass<?> clazz = getCtClassByName("MyClass");
final CtClass<?> clazz2 = getCtClassByName("MyClass2");

Expand All @@ -189,7 +189,7 @@ public void testOneReferenceWithMethodNotGenericOutOfTheClass() throws Exception
}

@Test
public void testMultiReferenceWithGenericMethodOutOfTheClass() throws Exception {
public void testMultiReferenceWithGenericMethodOutOfTheClass() {
final CtClass<?> clazz2 = getCtClassByName("MyClass2");
final CtClass<?> clazz3 = getCtClassByName("MyClass3");

Expand All @@ -204,7 +204,7 @@ public void testMultiReferenceWithGenericMethodOutOfTheClass() throws Exception
}

@Test
public void testReferencesBetweenMethods() throws Exception {
public void testReferencesBetweenMethods() {
final CtClass<?> clazz2 = getCtClassByName("MyClass2");

CtMethod<?> methodD = getCtMethodByNameFromCtClass(clazz2, "methodD");
Expand All @@ -223,7 +223,7 @@ public void testReferencesBetweenMethods() throws Exception {
}

@Test
public void testExecutableReferences() throws Exception {
public void testExecutableReferences() {
// factory has loaded MyClass, MyClass2 and MyClass3

CtClass<?> classMyClass = Query.getElements(factory, new NamedElementFilter<>(CtClass.class,"MyClass")).get(0);
Expand Down
Loading