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/12/29 14:12:57 UTC

[groovy] 04/28: Trivial refactoring: replace with direct class object access

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch refine-groovydoc
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 141c1bfca95a6aef70b9a7b8c1a875006d679c6c
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Dec 16 23:09:38 2018 +0800

    Trivial refactoring: replace with direct class object access
---
 src/main/groovy/groovy/lang/GroovyShell.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/groovy/groovy/lang/GroovyShell.java b/src/main/groovy/groovy/lang/GroovyShell.java
index a802d3c..84812b4 100644
--- a/src/main/groovy/groovy/lang/GroovyShell.java
+++ b/src/main/groovy/groovy/lang/GroovyShell.java
@@ -303,9 +303,10 @@ public class GroovyShell extends GroovyObjectSupport {
         Constructor constructor = null;
         Runnable runnable = null;
         Throwable reason = null;
+
         try {
             // first, fetch the constructor taking String[] as parameter
-            constructor = scriptClass.getConstructor((new String[]{}).getClass());
+            constructor = scriptClass.getConstructor(String[].class);
             try {
                 // instantiate a runnable and run it
                 runnable = (Runnable) constructor.newInstance(new Object[]{args});