Use multi-catch when possible

This commit is contained in:
Alexander Udalov
2017-04-01 00:33:19 +03:00
parent 34f0576135
commit 6aa0f7bb65
14 changed files with 16 additions and 68 deletions
@@ -87,20 +87,13 @@ public class KotlinLightClassCoherenceTest extends KotlinAsJavaTestBase {
}
public void assertPropertyCoherent(KtLightClass lightClass, String methodName) {
Class<?> reflect = PsiClass.class;
try {
Method method = reflect.getMethod(methodName);
Method method = PsiClass.class.getMethod(methodName);
Object lightResult = method.invoke(lightClass);
Object delegateResult = method.invoke(lightClass.getClsDelegate());
assertEquals("Result of method " + methodName + "() differs in light class and its delegate", delegateResult, lightResult);
}
catch (NoSuchMethodException e) {
throw new AssertionError(e);
}
catch (InvocationTargetException e) {
throw new AssertionError(e);
}
catch (IllegalAccessException e) {
catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
throw new AssertionError(e);
}
}
@@ -142,12 +142,9 @@ public class StdlibTest extends KotlinTestWithEnvironment {
return TestCase.class.isAssignableFrom(aClass) ? new TestSuite(aClass) :
TestRunnerUtil.isJUnit4TestClass(aClass) ? new JUnit4TestAdapter(aClass) : null;
}
catch (NoSuchMethodException e) {
catch (NoSuchMethodException | ClassNotFoundException e) {
// Ignore test classes we can't instantiate
return null;
}
catch (ClassNotFoundException e) {
return null;
}
}
}