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:51 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X e736f558c -> 288a232a7


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/288a232a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/288a232a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/288a232a

Branch: refs/heads/GROOVY_2_5_X
Commit: 288a232a72939f8211902d0399f8ca13fbfca6c4
Parents: e736f55
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:46 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/288a232a/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