You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/08/25 16:37:11 UTC
[2/2] groovy git commit: Minor refactoring: Identical 'catch'
branches in 'try' statement
Minor refactoring: Identical 'catch' branches in 'try' statement
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/26436eb5
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/26436eb5
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/26436eb5
Branch: refs/heads/master
Commit: 26436eb5eaeff73c11a47a8b03384b84ae79325f
Parents: 9d2c490
Author: Daniel Sun <su...@apache.org>
Authored: Sun Aug 26 00:35:28 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Sun Aug 26 00:35:28 2018 +0800
----------------------------------------------------------------------
src/main/groovy/groovy/grape/Grape.java | 6 +-----
src/main/groovy/groovy/lang/Closure.java | 12 +-----------
src/main/groovy/groovy/lang/GroovyClassLoader.java | 8 +-------
src/main/groovy/groovy/lang/GroovyShell.java | 6 +-----
src/main/groovy/groovy/lang/MetaClassImpl.java | 5 +----
.../org/codehaus/groovy/ast/tools/GenericsUtils.java | 6 +-----
.../org/codehaus/groovy/control/CompilationUnit.java | 4 +---
.../org/codehaus/groovy/reflection/CachedMethod.java | 4 +---
.../org/codehaus/groovy/runtime/InvokerHelper.java | 12 ++----------
.../groovy/runtime/NumberAwareComparator.java | 6 +-----
.../groovy/runtime/ProxyGeneratorAdapter.java | 12 ++----------
.../runtime/m12n/StandardPropertiesModuleFactory.java | 4 +---
.../runtime/metaclass/MetaClassRegistryImpl.java | 3 +--
.../runtime/metaclass/ReflectionMetaMethod.java | 4 +---
.../java/org/codehaus/groovy/tools/GroovyStarter.java | 14 +++-----------
.../ASTTransformationCollectorCodeVisitor.java | 4 +---
.../groovy/transform/ASTTransformationVisitor.java | 8 +-------
.../stc/GroovyTypeCheckingExtensionSupport.java | 10 ++--------
.../transform/stc/StaticTypeCheckingSupport.java | 6 +-----
.../transform/stc/StaticTypeCheckingVisitor.java | 12 ++----------
.../java/org/codehaus/groovy/vmplugin/v5/Java5.java | 3 +--
21 files changed, 27 insertions(+), 122 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/groovy/groovy/grape/Grape.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/grape/Grape.java b/src/main/groovy/groovy/grape/Grape.java
index ad89a20..31ae2d0 100644
--- a/src/main/groovy/groovy/grape/Grape.java
+++ b/src/main/groovy/groovy/grape/Grape.java
@@ -119,11 +119,7 @@ public class Grape {
// by default use GrapeIvy
//TODO META-INF/services resolver?
instance = (GrapeEngine) Class.forName("groovy.grape.GrapeIvy").newInstance();
- } catch (InstantiationException e) {
- //LOGME
- } catch (IllegalAccessException e) {
- //LOGME
- } catch (ClassNotFoundException e) {
+ } catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
//LOGME
}
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/groovy/groovy/lang/Closure.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/lang/Closure.java b/src/main/groovy/groovy/lang/Closure.java
index 9446186..a326ee7 100644
--- a/src/main/groovy/groovy/lang/Closure.java
+++ b/src/main/groovy/groovy/lang/Closure.java
@@ -318,7 +318,7 @@ public abstract class Closure<V> extends GroovyObjectSupport implements Cloneabl
// let's try getting the property on the first object
return InvokerHelper.getProperty(firstTry, property);
- } catch (MissingPropertyException e1) {
+ } catch (MissingPropertyException | MissingFieldException e1) {
if (secondTry != null && firstTry != this && firstTry != secondTry) {
try {
// let's try getting the property on the second object
@@ -329,16 +329,6 @@ public abstract class Closure<V> extends GroovyObjectSupport implements Cloneabl
}
throw e1;
- } catch (MissingFieldException e2) { // see GROOVY-5875
- if (secondTry != null && firstTry != this && firstTry != secondTry) {
- try {
- // let's try getting the property on the second object
- return InvokerHelper.getProperty(secondTry, property);
- } catch (GroovyRuntimeException e3) {
- // ignore, we'll throw e2
- }
- }
- throw e2;
}
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/groovy/groovy/lang/GroovyClassLoader.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/lang/GroovyClassLoader.java b/src/main/groovy/groovy/lang/GroovyClassLoader.java
index a84301a..90402ee 100644
--- a/src/main/groovy/groovy/lang/GroovyClassLoader.java
+++ b/src/main/groovy/groovy/lang/GroovyClassLoader.java
@@ -960,15 +960,9 @@ public class GroovyClassLoader extends URLClassLoader {
newURI = new URI(path);
// check if we can create a URL from that URI
newURI.toURL();
- } catch (URISyntaxException e) {
+ } catch (URISyntaxException | IllegalArgumentException | MalformedURLException e) {
// the URI has a false format, so lets try it with files ...
newURI=new File(path).toURI();
- } catch (MalformedURLException e) {
- // the URL has a false format, so lets try it with files ...
- newURI=new File(path).toURI();
- } catch (IllegalArgumentException e) {
- // the URL is not absolute, so lets try it with files ...
- newURI=new File(path).toURI();
}
URL[] urls = getURLs();
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/groovy/groovy/lang/GroovyShell.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/lang/GroovyShell.java b/src/main/groovy/groovy/lang/GroovyShell.java
index 53bc6e6..3570809 100644
--- a/src/main/groovy/groovy/lang/GroovyShell.java
+++ b/src/main/groovy/groovy/lang/GroovyShell.java
@@ -262,12 +262,8 @@ public class GroovyShell extends GroovyObjectSupport {
try {
Script script = InvokerHelper.newScript(scriptClass, context);
return script.run();
- } catch (InstantiationException e) {
+ } catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
// ignore instantiation errors,, try to do main
- } catch (IllegalAccessException e) {
- // ignore instantiation errors, try to do main
- } catch (InvocationTargetException e) {
- // ignore instantiation errors, try to do main
}
}
try {
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/groovy/groovy/lang/MetaClassImpl.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/lang/MetaClassImpl.java b/src/main/groovy/groovy/lang/MetaClassImpl.java
index d2c6b9d..f20d455 100644
--- a/src/main/groovy/groovy/lang/MetaClassImpl.java
+++ b/src/main/groovy/groovy/lang/MetaClassImpl.java
@@ -1866,10 +1866,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
if (method == null && mp != null) {
try {
return mp.getProperty(object);
- } catch (IllegalArgumentException e) {
- // can't access the field directly but there may be a getter
- mp = null;
- } catch (CacheAccessControlException e) {
+ } catch (IllegalArgumentException | CacheAccessControlException e) {
// can't access the field directly but there may be a getter
mp = null;
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
index 06c8d84..c7af72d 100644
--- a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
+++ b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
@@ -583,11 +583,7 @@ public class GenericsUtils {
signature[i] = resolveClassNode(sourceUnit, compilationUnit, mn, usage, genericsType.getType());
}
return signature;
- } catch (RecognitionException e) {
- sourceUnit.addError(new IncorrectTypeHintException(mn, e, usage.getLineNumber(), usage.getColumnNumber()));
- } catch (TokenStreamException e) {
- sourceUnit.addError(new IncorrectTypeHintException(mn, e, usage.getLineNumber(), usage.getColumnNumber()));
- } catch (ParserException e) {
+ } catch (RecognitionException | ParserException | TokenStreamException e) {
sourceUnit.addError(new IncorrectTypeHintException(mn, e, usage.getLineNumber(), usage.getColumnNumber()));
}
return null;
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/control/CompilationUnit.java b/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
index edb4e8e..8648a31 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilationUnit.java
@@ -1095,12 +1095,10 @@ public class CompilationUnit extends ProcessingUnit {
} catch (GroovyBugError e) {
changeBugText(e, context);
throw e;
- } catch (NoClassDefFoundError e) {
+ } catch (NoClassDefFoundError | Exception e) {
// effort to get more logging in case a dependency of a class is loaded
// although it shouldn't have
convertUncaughtExceptionToCompilationError(e);
- } catch (Exception e) {
- convertUncaughtExceptionToCompilationError(e);
}
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/reflection/CachedMethod.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/reflection/CachedMethod.java b/src/main/java/org/codehaus/groovy/reflection/CachedMethod.java
index 6014c85..1c8f3b3 100644
--- a/src/main/java/org/codehaus/groovy/reflection/CachedMethod.java
+++ b/src/main/java/org/codehaus/groovy/reflection/CachedMethod.java
@@ -102,9 +102,7 @@ public class CachedMethod extends MetaMethod implements Comparable {
}
try {
return cachedMethod.invoke(object, arguments);
- } catch (IllegalArgumentException e) {
- throw new InvokerInvocationException(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw new InvokerInvocationException(e);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java b/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
index f75c08b..c876f43 100644
--- a/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
+++ b/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
@@ -639,13 +639,7 @@ public class InvokerHelper {
try {
Method serialize = Class.forName("groovy.xml.XmlUtil").getMethod("serialize", Element.class);
return (String) serialize.invoke(null, arguments);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
+ } catch (ClassNotFoundException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
@@ -921,10 +915,8 @@ public class InvokerHelper {
public static List createRange(Object from, Object to, boolean inclusive) {
try {
return ScriptBytecodeAdapter.createRange(from, to, inclusive);
- } catch (RuntimeException re) {
+ } catch (RuntimeException | Error re) {
throw re;
- } catch (Error e) {
- throw e;
} catch (Throwable t) {
throw new RuntimeException(t);
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/runtime/NumberAwareComparator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/NumberAwareComparator.java b/src/main/java/org/codehaus/groovy/runtime/NumberAwareComparator.java
index ee4c8c4..c44a48e 100644
--- a/src/main/java/org/codehaus/groovy/runtime/NumberAwareComparator.java
+++ b/src/main/java/org/codehaus/groovy/runtime/NumberAwareComparator.java
@@ -35,11 +35,7 @@ public class NumberAwareComparator<T> implements Comparator<T>, Serializable {
public int compare(T o1, T o2) {
try {
return DefaultTypeTransformation.compareTo(o1, o2);
- } catch (ClassCastException cce) {
- /* ignore */
- } catch (GroovyRuntimeException gre) {
- /* ignore */
- } catch (IllegalArgumentException iae) {
+ } catch (ClassCastException | IllegalArgumentException | GroovyRuntimeException cce) {
/* ignore */
}
// since the object does not have a valid compareTo method
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java b/src/main/java/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java
index 1874fc9..3c709d5 100644
--- a/src/main/java/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java
+++ b/src/main/java/org/codehaus/groovy/runtime/ProxyGeneratorAdapter.java
@@ -823,11 +823,7 @@ public class ProxyGeneratorAdapter extends ClassVisitor implements Opcodes {
// if there isn't any argument, we can make invocation faster using the cached constructor
try {
return (GroovyObject) cachedNoArgConstructor.newInstance(map);
- } catch (InstantiationException e) {
- throw new GroovyRuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new GroovyRuntimeException(e);
- } catch (InvocationTargetException e) {
+ } catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
throw new GroovyRuntimeException(e);
}
}
@@ -844,11 +840,7 @@ public class ProxyGeneratorAdapter extends ClassVisitor implements Opcodes {
// if there isn't any argument, we can make invocation faster using the cached constructor
try {
return (GroovyObject) cachedNoArgConstructor.newInstance(map, delegate);
- } catch (InstantiationException e) {
- throw new GroovyRuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new GroovyRuntimeException(e);
- } catch (InvocationTargetException e) {
+ } catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
throw new GroovyRuntimeException(e);
}
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/runtime/m12n/StandardPropertiesModuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/m12n/StandardPropertiesModuleFactory.java b/src/main/java/org/codehaus/groovy/runtime/m12n/StandardPropertiesModuleFactory.java
index 870cbee..87946a6 100644
--- a/src/main/java/org/codehaus/groovy/runtime/m12n/StandardPropertiesModuleFactory.java
+++ b/src/main/java/org/codehaus/groovy/runtime/m12n/StandardPropertiesModuleFactory.java
@@ -42,9 +42,7 @@ public class StandardPropertiesModuleFactory extends PropertiesModuleFactory {
return delegate.newModule(properties, classLoader);
} catch (ClassNotFoundException e) {
throw new GroovyRuntimeException("Unable to load module factory ["+factoryName+"]",e);
- } catch (InstantiationException e) {
- throw new GroovyRuntimeException("Unable to instantiate module factory ["+factoryName+"]",e);
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
throw new GroovyRuntimeException("Unable to instantiate module factory ["+factoryName+"]",e);
}
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java
index 40416a3..eda5f06 100644
--- a/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java
+++ b/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java
@@ -261,8 +261,7 @@ public class MetaClassRegistryImpl implements MetaClassRegistry{
}
arr.add(method);
instanceMethods.add(method);
- } catch (InstantiationException e) { /* ignore */
- } catch (IllegalAccessException e) { /* ignore */
+ } catch (InstantiationException | IllegalAccessException e) { /* ignore */
}
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectionMetaMethod.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectionMetaMethod.java b/src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectionMetaMethod.java
index 1c6a6f2..4566e73 100644
--- a/src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectionMetaMethod.java
+++ b/src/main/java/org/codehaus/groovy/runtime/metaclass/ReflectionMetaMethod.java
@@ -52,9 +52,7 @@ public class ReflectionMetaMethod extends MetaMethod {
public Object invoke(Object object, Object[] arguments) {
try {
return method.setAccessible().invoke(object, arguments);
- } catch (IllegalArgumentException e) {
- throw new InvokerInvocationException(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw new InvokerInvocationException(e);
} catch (InvocationTargetException e) {
throw e.getCause() instanceof RuntimeException ? (RuntimeException)e.getCause() : new InvokerInvocationException(e);
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/tools/GroovyStarter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/tools/GroovyStarter.java b/src/main/java/org/codehaus/groovy/tools/GroovyStarter.java
index 141ad00..08f8f1c 100644
--- a/src/main/java/org/codehaus/groovy/tools/GroovyStarter.java
+++ b/src/main/java/org/codehaus/groovy/tools/GroovyStarter.java
@@ -103,22 +103,14 @@ public class GroovyStarter {
try {
Class c = loader.loadClass(lc.getMainClass());
m = c.getMethod("main", String[].class);
- } catch (ClassNotFoundException e1) {
+ } catch (ClassNotFoundException | NoSuchMethodException | SecurityException e1) {
exit(e1);
- } catch (SecurityException e2) {
- exit(e2);
- } catch (NoSuchMethodException e2) {
- exit(e2);
}
try {
m.invoke(null, new Object[]{newArgs});
- } catch (IllegalArgumentException e3) {
+ } catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException e3) {
exit(e3);
- } catch (IllegalAccessException e3) {
- exit(e3);
- } catch (InvocationTargetException e3) {
- exit(e3);
- }
+ }
}
private static void exit(Exception e) {
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/transform/ASTTransformationCollectorCodeVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/transform/ASTTransformationCollectorCodeVisitor.java b/src/main/java/org/codehaus/groovy/transform/ASTTransformationCollectorCodeVisitor.java
index 29def6c..c827b04 100644
--- a/src/main/java/org/codehaus/groovy/transform/ASTTransformationCollectorCodeVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/ASTTransformationCollectorCodeVisitor.java
@@ -224,9 +224,7 @@ public class ASTTransformationCollectorCodeVisitor extends ClassCodeVisitorSuppo
if (klass != null) {
try {
act = (AnnotationCollectorTransform) klass.newInstance();
- } catch (InstantiationException e) {
- source.getErrorCollector().addErrorAndContinue(new ExceptionMessage(e, true, source));
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
source.getErrorCollector().addErrorAndContinue(new ExceptionMessage(e, true, source));
}
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/transform/ASTTransformationVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/transform/ASTTransformationVisitor.java b/src/main/java/org/codehaus/groovy/transform/ASTTransformationVisitor.java
index 150603c..63819e9 100644
--- a/src/main/java/org/codehaus/groovy/transform/ASTTransformationVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/ASTTransformationVisitor.java
@@ -109,13 +109,7 @@ public final class ASTTransformationVisitor extends ClassCodeVisitorSupport {
for (Class<? extends ASTTransformation> transformClass : baseTransforms.keySet()) {
try {
transformInstances.put(transformClass, transformClass.newInstance());
- } catch (InstantiationException e) {
- source.getErrorCollector().addError(
- new SimpleMessage(
- "Could not instantiate Transformation Processor " + transformClass
- , //+ " declared by " + annotation.getClassNode().getName(),
- source));
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
source.getErrorCollector().addError(
new SimpleMessage(
"Could not instantiate Transformation Processor " + transformClass
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/transform/stc/GroovyTypeCheckingExtensionSupport.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/transform/stc/GroovyTypeCheckingExtensionSupport.java b/src/main/java/org/codehaus/groovy/transform/stc/GroovyTypeCheckingExtensionSupport.java
index 6254b0a..6d8b36c 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/GroovyTypeCheckingExtensionSupport.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/GroovyTypeCheckingExtensionSupport.java
@@ -139,24 +139,18 @@ public class GroovyTypeCheckingExtensionSupport extends AbstractTypeCheckingExte
typeCheckingVisitor.addTypeCheckingExtension(extension);
extension.setup();
return;
- } catch (InstantiationException e) {
- addLoadingError(config);
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
addLoadingError(config);
} catch (NoSuchMethodException e) {
context.getErrorCollector().addFatalError(
new SimpleMessage("Static type checking extension '" + scriptPath + "' could not be loaded because it doesn't have a constructor accepting StaticTypeCheckingVisitor.",
config.getDebug(), typeCheckingVisitor.getSourceUnit())
);
- } catch (InvocationTargetException e) {
- addLoadingError(config);
}
}
} catch (ClassNotFoundException e) {
// silent
- } catch (InstantiationException e) {
- addLoadingError(config);
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
addLoadingError(config);
}
if (script==null) {
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
index 02c5658..061cfb7 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
@@ -2396,11 +2396,7 @@ public abstract class StaticTypeCheckingSupport {
Class aClass = cu.getClassLoader().defineClass(className, classes.get(0).getBytes());
try {
return aClass.getMethod("eval").invoke(null);
- } catch (IllegalAccessException e) {
- throw new GroovyBugError(e);
- } catch (InvocationTargetException e) {
- throw new GroovyBugError(e);
- } catch (NoSuchMethodException e) {
+ } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
throw new GroovyBugError(e);
}
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
index 8b9ed1c..2f48985 100644
--- a/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -2736,11 +2736,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
typeCheckingContext.source,
typeCheckingContext.compilationUnit,
convertToStringArray(options), expression);
- } catch (ClassNotFoundException e) {
- throw new GroovyBugError(e);
- } catch (InstantiationException e) {
- throw new GroovyBugError(e);
- } catch (IllegalAccessException e) {
+ } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
throw new GroovyBugError(e);
}
return closureSignatures;
@@ -2762,11 +2758,7 @@ public class StaticTypeCheckingVisitor extends ClassCodeVisitorSupport {
typeCheckingContext.source,
typeCheckingContext.compilationUnit,
convertToStringArray(options));
- } catch (ClassNotFoundException e) {
- throw new GroovyBugError(e);
- } catch (InstantiationException e) {
- throw new GroovyBugError(e);
- } catch (IllegalAccessException e) {
+ } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
throw new GroovyBugError(e);
}
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/26436eb5/src/main/java/org/codehaus/groovy/vmplugin/v5/Java5.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v5/Java5.java b/src/main/java/org/codehaus/groovy/vmplugin/v5/Java5.java
index 1c0a468..ec462a1 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v5/Java5.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v5/Java5.java
@@ -285,8 +285,7 @@ public class Java5 implements VMPlugin {
if (valueExpression == null)
continue;
node.setMember(declaredMethod.getName(), valueExpression);
- } catch (IllegalAccessException e) {
- } catch (InvocationTargetException e) {
+ } catch (IllegalAccessException | InvocationTargetException e) {
}
}
}