groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Minor refactoring
Date Thu, 16 Nov 2017 12:23:27 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 19af0e05c -> fd90d099d


Minor refactoring

(cherry picked from commit c1593ae)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/fd90d099
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/fd90d099
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/fd90d099

Branch: refs/heads/GROOVY_2_6_X
Commit: fd90d099d213ae5be521a7930e4d69c6ec2d9b02
Parents: 19af0e0
Author: sunlan <sunlan@apache.org>
Authored: Thu Nov 16 20:22:54 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Thu Nov 16 20:23:21 2017 +0800

----------------------------------------------------------------------
 src/main/groovy/lang/GroovyShell.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/fd90d099/src/main/groovy/lang/GroovyShell.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/lang/GroovyShell.java b/src/main/groovy/lang/GroovyShell.java
index 7b404cb..78eac63 100644
--- a/src/main/groovy/lang/GroovyShell.java
+++ b/src/main/groovy/lang/GroovyShell.java
@@ -282,7 +282,7 @@ public class GroovyShell extends GroovyObjectSupport {
         }
         try {
             // let's find a main method
-            scriptClass.getMethod("main", new Class[]{String[].class});
+            scriptClass.getMethod("main", String[].class);
             // if that main method exist, invoke it
             return InvokerHelper.invokeMethod(scriptClass, "main", new Object[]{args});
         } catch (NoSuchMethodException e) {
@@ -319,7 +319,7 @@ public class GroovyShell extends GroovyObjectSupport {
         Throwable reason = null;
         try {
             // first, fetch the constructor taking String[] as parameter
-            constructor = scriptClass.getConstructor(new Class[]{(new String[]{}).getClass()});
+            constructor = scriptClass.getConstructor((new String[]{}).getClass());
             try {
                 // instantiate a runnable and run it
                 runnable = (Runnable) constructor.newInstance(new Object[]{args});
@@ -329,7 +329,7 @@ public class GroovyShell extends GroovyObjectSupport {
         } catch (NoSuchMethodException e1) {
             try {
                 // otherwise, find the default constructor
-                constructor = scriptClass.getConstructor(new Class[]{});
+                constructor = scriptClass.getConstructor();
                 try {
                     // instantiate a runnable and run it
                     runnable = (Runnable) constructor.newInstance();


Mime
View raw message