This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 000961028233d185ae646cce768efbbf0824b77d Author: Daniel Sun <sun...@apache.org> AuthorDate: Sun Dec 16 23:09:38 2018 +0800 Trivial refactoring: replace with direct class object access (cherry picked from commit 5e8574ebf161aaecdb0fdffb35a4ae1b43e52272) --- 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 3570809..8d18fbd 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});