Repository: groovy Updated Branches: refs/heads/GROOVY_2_4_X 5d9a2cddc -> 0218e498a
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/0218e498 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/0218e498 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/0218e498 Branch: refs/heads/GROOVY_2_4_X Commit: 0218e498a40436493d97f2f4372f7bec7e112379 Parents: 5d9a2cd Author: sunlan <[email protected]> Authored: Thu Nov 16 20:22:54 2017 +0800 Committer: sunlan <[email protected]> Committed: Thu Nov 16 20:24:16 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/0218e498/src/main/groovy/lang/GroovyShell.java ---------------------------------------------------------------------- diff --git a/src/main/groovy/lang/GroovyShell.java b/src/main/groovy/lang/GroovyShell.java index a8b8941..bbbdb57 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) { @@ -330,7 +330,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}); @@ -340,7 +340,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();
