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/16 15:13:04 UTC

[groovy] branch master updated: 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 master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e8574e  Trivial refactoring: replace with direct class object access
5e8574e is described below

commit 5e8574ebf161aaecdb0fdffb35a4ae1b43e52272
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});