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/07/19 11:39:56 UTC

[groovy] branch GROOVY_3_0_X updated: fix unintentional glitch on JDK14

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

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


The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
     new 095c9bd  fix unintentional glitch on JDK14
095c9bd is described below

commit 095c9bdd1abab714903ffa79d14bfc201f408a61
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sun Jul 19 21:39:33 2020 +1000

    fix unintentional glitch on JDK14
---
 src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

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 57d5413..2ac8ef3 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
@@ -172,6 +172,16 @@ public class Java9 extends Java8 {
         return 9;
     }
 
+    @Override
+    public Object getInvokeSpecialHandle(Method method, Object receiver) {
+        final Class<?> receiverType = receiver.getClass();
+        try {
+            return of(receiverType).unreflectSpecial(method, receiverType).bindTo(receiver);
+        } catch (ReflectiveOperationException e) {
+            return super.getInvokeSpecialHandle(method, receiver);
+        }
+    }
+
     /**
      * This method may be used by a caller in class C to check whether to enable access to a member of declaring class D successfully
      * if {@link Java8#checkCanSetAccessible(java.lang.reflect.AccessibleObject, java.lang.Class)} returns true and any of the following hold: