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 2022/08/28 14:04:14 UTC
[groovy] branch danielsun/fix-clone-array-based-on-groovy10730pr updated: Fix illegal access issues
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch danielsun/fix-clone-array-based-on-groovy10730pr
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/danielsun/fix-clone-array-based-on-groovy10730pr by this push:
new 9abed60959 Fix illegal access issues
9abed60959 is described below
commit 9abed609598039894a52ea904f39ce0bd3be3d66
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Aug 28 22:03:51 2022 +0800
Fix illegal access issues
---
src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java b/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
index 66926668b3..e39de8d48c 100644
--- a/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
+++ b/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
@@ -586,6 +586,10 @@ public class InvokerHelper {
// it's an instance; check if it's a Java one
if (!(object instanceof GroovyObject)) {
+ if (null != object && object.getClass().isArray() && "clone".equals(methodName) && (null == arguments || arguments.getClass().isArray() && 0 == ((Object[]) arguments).length)) {
+ return ArrayUtil.cloneArray((Object[]) object);
+ }
+
return invokePojoMethod(object, methodName, arguments);
}