groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] 01/02: Support better extensibility for caller class
Date Sun, 03 Nov 2019 04:38:58 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 75ab9fa4bdd90f089b22b95b422e0d78814bccb5
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Sun Nov 3 12:31:12 2019 +0800

    Support better extensibility for caller class
    
    (cherry picked from commit 8ec7bf71f2ba13fcca059fffb92ae5b76707d3c7)
---
 .../java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java | 2 +-
 .../java/org/codehaus/groovy/runtime/callsite/PojoMetaMethodSite.java | 2 +-
 src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java              | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java b/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
index cc8be1e..89a563e 100644
--- a/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
+++ b/src/main/java/org/codehaus/groovy/runtime/callsite/PogoMetaMethodSite.java
@@ -160,7 +160,7 @@ public class PogoMetaMethodSite extends PlainObjectMetaMethodSite {
         final Method reflect;
 
         public PogoCachedMethodSite(CallSite site, MetaClassImpl metaClass, CachedMethod
metaMethod, Class[] params) {
-            super(site, metaClass, VM_PLUGIN.transformMetaMethod(metaClass, metaMethod, params,
site.getArray().owner), params);
+            super(site, metaClass, VM_PLUGIN.transformMetaMethod(metaClass, metaMethod, params),
params);
             reflect = ((CachedMethod) super.metaMethod).setAccessible();
         }
 
diff --git a/src/main/java/org/codehaus/groovy/runtime/callsite/PojoMetaMethodSite.java b/src/main/java/org/codehaus/groovy/runtime/callsite/PojoMetaMethodSite.java
index e1ab089..ff77eea 100644
--- a/src/main/java/org/codehaus/groovy/runtime/callsite/PojoMetaMethodSite.java
+++ b/src/main/java/org/codehaus/groovy/runtime/callsite/PojoMetaMethodSite.java
@@ -181,7 +181,7 @@ public class PojoMetaMethodSite extends PlainObjectMetaMethodSite {
         final Method reflect;
 
         public PojoCachedMethodSite(CallSite site, MetaClassImpl metaClass, MetaMethod metaMethod,
Class[] params) {
-            super(site, metaClass, VM_PLUGIN.transformMetaMethod(metaClass, metaMethod, params,
site.getArray().owner), params);
+            super(site, metaClass, VM_PLUGIN.transformMetaMethod(metaClass, metaMethod, params),
params);
             reflect = ((CachedMethod) super.metaMethod).setAccessible();
         }
 
diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
index 797eae0..7c8390d 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
@@ -184,7 +184,9 @@ public class Java9 extends Java8 {
 
         int methodModifiers = cachedMethod.getModifiers();
 
-        caller = ReflectionUtils.class; // "set accessible" are done via `org.codehaus.groovy.reflection.ReflectionUtils`
as shown in warnings
+        if (null == caller) {
+            caller = ReflectionUtils.class; // "set accessible" are done via `org.codehaus.groovy.reflection.ReflectionUtils`
as shown in warnings
+        }
 
         // if caller can access the method,
         // no need to transform the meta method


Mime
View raw message