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 2021/06/13 11:36:03 UTC

[groovy] branch danielsun/tweak-build updated (0bc9932 -> 424812c)

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

sunlan pushed a change to branch danielsun/tweak-build
in repository https://gitbox.apache.org/repos/asf/groovy.git.


 discard 0bc9932  Fix illegal access to dynamic proxy
     new 424812c  GROOVY-10137: [JDK16] Illegal access to dynamic proxy

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (0bc9932)
            \
             N -- N -- N   refs/heads/danielsun/tweak-build (424812c)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:

[groovy] 01/01: GROOVY-10137: [JDK16] Illegal access to dynamic proxy

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch danielsun/tweak-build
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 424812cd6a4b620cb463e4fedc172b4dfc5378e8
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Jun 13 18:55:34 2021 +0800

    GROOVY-10137: [JDK16] Illegal access to dynamic proxy
---
 src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java | 7 +++++++
 1 file changed, 7 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 1600070..bf476e4 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
@@ -42,6 +42,7 @@ import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
 import java.math.BigInteger;
 import java.net.URI;
 import java.util.ArrayList;
@@ -179,6 +180,12 @@ public class Java9 extends Java8 {
 
     public static MethodHandles.Lookup of(final Class<?> declaringClass) {
         try {
+            // All proxy classes are not open for reflective access in Java SE 16
+            // See also https://www.oracle.com/java/technologies/javase/16-relnotes.html
+            if (Proxy.isProxyClass(declaringClass)) {
+                return MethodHandles.lookup().in(declaringClass);
+            }
+
             final Method privateLookup = getPrivateLookup();
             if (privateLookup != null) {
                 return (MethodHandles.Lookup) privateLookup.invoke(null, declaringClass, MethodHandles.lookup());