Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2018-01-12 10:47:53 +0000
committerLars Vogel2018-01-15 13:43:00 +0000
commit0767984d103c762708f7930f081d1493ee589679 (patch)
tree3c74cc8b788808b2108dee7403af27fe054afbf7
parent7a2def0bd858ffff807a9631895561e7a95de86f (diff)
downloadeclipse.platform.text-0767984d103c762708f7930f081d1493ee589679.tar.gz
eclipse.platform.text-0767984d103c762708f7930f081d1493ee589679.tar.xz
eclipse.platform.text-0767984d103c762708f7930f081d1493ee589679.zip
Bug 529716 - Combine catch blocks in org.eclipse.text.tests.AccessorI20180117-2000I20180116-2000I20180115-2000
Change-Id: I79a5ac9a67c3e763e27e3102b328a8cf48c0c032 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java62
1 files changed, 14 insertions, 48 deletions
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java
index 674e7033888..a130d0f12f3 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/Accessor.java
@@ -64,9 +64,7 @@ public class Accessor {
fInstance= instance;
try {
fClass= Class.forName(className, true, classLoader);
- } catch (ClassNotFoundException e) {
- fail(e);
- } catch (ExceptionInInitializerError e) {
+ } catch (ClassNotFoundException | ExceptionInInitializerError e) {
fail(e);
}
}
@@ -98,30 +96,20 @@ public class Accessor {
public Accessor(String className, ClassLoader classLoader, Class<?>[] constructorTypes, Object[] constructorArgs) {
try {
fClass= Class.forName(className, true, classLoader);
- } catch (ClassNotFoundException e) {
- fail(e);
- } catch (ExceptionInInitializerError e) {
+ } catch (ClassNotFoundException | ExceptionInInitializerError e) {
fail(e);
}
Constructor<?> constructor= null;
try {
constructor= fClass.getDeclaredConstructor(constructorTypes);
- } catch (SecurityException e) {
- fail(e);
- } catch (NoSuchMethodException e) {
+ } catch (SecurityException | NoSuchMethodException e) {
fail(e);
}
Assert.isNotNull(constructor);
constructor.setAccessible(true);
try {
fInstance= constructor.newInstance(constructorArgs);
- } catch (IllegalArgumentException e) {
- fail(e);
- } catch (InvocationTargetException e) {
- fail(e);
- } catch (InstantiationException e) {
- fail(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
fail(e);
}
}
@@ -138,9 +126,7 @@ public class Accessor {
public Accessor(String className, ClassLoader classLoader) {
try {
fClass= Class.forName(className, true, classLoader);
- } catch (ClassNotFoundException e) {
- fail(e);
- } catch (ExceptionInInitializerError e) {
+ } catch (ClassNotFoundException | ExceptionInInitializerError e) {
fail(e);
}
}
@@ -173,20 +159,14 @@ public class Accessor {
Method method= null;
try {
method= fClass.getDeclaredMethod(methodName, types);
- } catch (SecurityException e) {
- fail(e);
- } catch (NoSuchMethodException e) {
+ } catch (SecurityException | NoSuchMethodException e) {
fail(e);
}
Assert.isNotNull(method);
method.setAccessible(true);
try {
return method.invoke(fInstance, arguments);
- } catch (IllegalArgumentException e) {
- fail(e);
- } catch (InvocationTargetException e) {
- fail(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e) {
fail(e);
}
return null;
@@ -202,9 +182,7 @@ public class Accessor {
Field field= getField(fieldName);
try {
field.set(fInstance, value);
- } catch (IllegalArgumentException e) {
- fail(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
fail(e);
}
}
@@ -219,9 +197,7 @@ public class Accessor {
Field field= getField(fieldName);
try {
field.setBoolean(fInstance, value);
- } catch (IllegalArgumentException e) {
- fail(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
fail(e);
}
}
@@ -236,9 +212,7 @@ public class Accessor {
Field field= getField(fieldName);
try {
field.setInt(fInstance, value);
- } catch (IllegalArgumentException e) {
- fail(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
fail(e);
}
}
@@ -253,9 +227,7 @@ public class Accessor {
Field field= getField(fieldName);
try {
return field.get(fInstance);
- } catch (IllegalArgumentException e) {
- fail(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
fail(e);
}
// Unreachable code
@@ -272,9 +244,7 @@ public class Accessor {
Field field= getField(fieldName);
try {
return field.getBoolean(fInstance);
- } catch (IllegalArgumentException e) {
- fail(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
fail(e);
}
// Unreachable code
@@ -291,9 +261,7 @@ public class Accessor {
Field field= getField(fieldName);
try {
return field.getInt(fInstance);
- } catch (IllegalArgumentException e) {
- fail(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
fail(e);
}
// Unreachable code
@@ -304,9 +272,7 @@ public class Accessor {
Field field= null;
try {
field= fClass.getDeclaredField(fieldName);
- } catch (SecurityException e) {
- fail(e);
- } catch (NoSuchFieldException e) {
+ } catch (SecurityException | NoSuchFieldException e) {
fail(e);
}
field.setAccessible(true);

Back to the top