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 2020/07/19 10:59:31 UTC

[groovy] branch danielsun/tweak-vmplugin created (now d32b423)

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

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


      at d32b423  Try to fix the failing build on JDK14

This branch includes the following new commits:

     new d32b423  Try to fix the failing build on JDK14

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.



[groovy] 01/01: Try to fix the failing build on JDK14

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-vmplugin
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit d32b4236099d82be575cbe48964ce35ca2d4e535
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Jul 19 18:58:56 2020 +0800

    Try to fix the failing build on JDK14
---
 src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java | 8 ++++++--
 src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java | 9 +++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java b/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
index bf865da..dd13d9a 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
@@ -141,7 +141,11 @@ public class Java8 implements VMPlugin {
         mn.setAnnotationDefault(true);
     }
 
-    private static Constructor<MethodHandles.Lookup> getLookupConstructor() {
+    protected Constructor<MethodHandles.Lookup> getLookupConstructor() {
+        return getLookupConstructorOfJava8();
+    }
+
+    private static Constructor<MethodHandles.Lookup> getLookupConstructorOfJava8() {
         return LookupHolder.LOOKUP_Constructor;
     }
 
@@ -652,7 +656,7 @@ public class Java8 implements VMPlugin {
 
     public static MethodHandles.Lookup of(final Class<?> declaringClass) {
         try {
-            return getLookupConstructor().newInstance(declaringClass, MethodHandles.Lookup.PRIVATE).in(declaringClass);
+            return getLookupConstructorOfJava8().newInstance(declaringClass, MethodHandles.Lookup.PRIVATE).in(declaringClass);
         } catch (final IllegalAccessException | InstantiationException e) {
             throw new IllegalArgumentException(e);
         } catch (final InvocationTargetException e) {
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 a004a67..1761fb8 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
@@ -156,7 +156,12 @@ public class Java9 extends Java8 {
         }
     }
 
-    private static Constructor<MethodHandles.Lookup> getLookupConstructor() {
+    @Override
+    protected Constructor<MethodHandles.Lookup> getLookupConstructor() {
+        return getLookupConstructorOfJava9();
+    }
+
+    private static Constructor<MethodHandles.Lookup> getLookupConstructorOfJava9() {
         return LookupHolder.LOOKUP_Constructor;
     }
 
@@ -170,7 +175,7 @@ public class Java9 extends Java8 {
             if (privateLookup != null) {
                 return (MethodHandles.Lookup) privateLookup.invoke(null, declaringClass, MethodHandles.lookup());
             }
-            return getLookupConstructor().newInstance(declaringClass, MethodHandles.Lookup.PRIVATE).in(declaringClass);
+            return getLookupConstructorOfJava9().newInstance(declaringClass, MethodHandles.Lookup.PRIVATE).in(declaringClass);
         } catch (final IllegalAccessException | InstantiationException e) {
             throw new IllegalArgumentException(e);
         } catch (final InvocationTargetException e) {