You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/06/24 00:00:30 UTC

[groovy] branch GROOVY_2_5_X updated: GROOVY-9554: fix for 2_5_X

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

paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push:
     new 0252b35  GROOVY-9554: fix for 2_5_X
0252b35 is described below

commit 0252b35859f7ab4b65b9c73ea3778b5a12e38856
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Jun 24 10:00:21 2020 +1000

    GROOVY-9554: fix for 2_5_X
---
 src/main/groovy/groovy/lang/Script.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main/groovy/groovy/lang/Script.java b/src/main/groovy/groovy/lang/Script.java
index de29c9b..d48920f 100644
--- a/src/main/groovy/groovy/lang/Script.java
+++ b/src/main/groovy/groovy/lang/Script.java
@@ -18,7 +18,6 @@
  */
 package groovy.lang;
 
-import org.apache.groovy.util.BeanUtils;
 import org.codehaus.groovy.ast.expr.ArgumentListExpression;
 import org.codehaus.groovy.control.CompilationFailedException;
 import org.codehaus.groovy.runtime.DefaultGroovyMethods;
@@ -28,6 +27,8 @@ import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Method;
 
+import static org.codehaus.groovy.runtime.MetaClassHelper.capitalize;
+
 /**
  * This object represents a Groovy script
  */
@@ -73,9 +74,9 @@ public abstract class Script extends GroovyObjectSupport {
     }
 
     private boolean hasSetterMethodFor(String property) {
-        String setterName = "set" + BeanUtils.capitalize(property);
+        String setterName = "set" + capitalize(property);
         for (Method method : getClass().getDeclaredMethods()) {
-            if (method.getParameterCount() == 1
+            if (method.getParameterTypes().length == 1
                     // TODO: Test modifiers or return type?
                     && method.getName().equals(setterName)) {
                 return true;