You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Graeme Rocher <gr...@gmail.com> on 2021/04/22 12:24:39 UTC

Groovy with JDK 16

Hi all,

We are close to getting Micronaut's JDK 16 builds passing however some
tests are failing that are related to Groovy and Spock that I am unsure how
to fix.

Most of the errors are like:

java.lang.reflect.InvocationTargetException
    at org.codehaus.groovy.vmplugin.v9.Java9.of(Java9.java:160)
    at
org.codehaus.groovy.vmplugin.v9.Java9.getInvokeSpecialHandle(Java9.java:179)
    at
java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
    at io.micronaut.core.io.WritableSpec.test flush is
called(WritableSpec.groovy:13)
Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
open jdk.proxy3 to unnamed module @71559e7c
    at
java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:260)
    ... 4 more

Which seems to be related to the creation of proxies for closures as the
code in question that fails looks like:

    @Get(value = "/welcome", produces = MediaType.TEXT_PLAIN)
    Writable render() { // <2>
        { writer ->
            template.make( // <3>
                    firstName: "Fred",
                    lastName: "Flintstone"
            ).writeTo(writer)
        }
    }

There is a single other failure with this Spock error message:

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make
field static final java.lang.invoke.MethodHandles$Lookup
java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module
java.base does not "opens java.lang.invoke" to unnamed module @533e0c7
    at
org.spockframework.mock.runtime.DefaultMethodInvoker.respond(DefaultMethodInvoker.java:50)
    ... 27 more


Are these problems something that has been resolved or being looked at? I
haven't seen anything with a brief look through the issue tracker.

Thanks for the feedback
-- 
Graeme Rocher

Re: Groovy with JDK 16

Posted by Daniel Sun <su...@apache.org>.
JDK16 should be supported fully if the PR is accepted:
https://github.com/apache/groovy/pull/1598

Cheers,
Daniel Sun

On 2021/06/15 02:35:18, Daniel Sun <su...@apache.org> wrote: 
> Hi Graeme,
> 
> > is there an issue report to track this or should I file one?
> 
> The issue reports were created, and I've already fixed the dynamic proxy related issues in the PR[1].
> https://issues.apache.org/jira/browse/GROOVY-10137
> https://issues.apache.org/jira/browse/GROOVY-10138
> 
> Other issues were found when running on JDK16 too, see http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
> 
> P.S. sorry for the late reply. I'm too busy recently to look into issues...
> 
> 
> [1] https://github.com/apache/groovy/pull/1598
> 
> Cheers,
> Daniel Sun
> On 2021/05/01 18:53:19, Graeme Rocher <gr...@gmail.com> wrote: 
> > Thanks Daniel, is there an issue report to track this or should I file one?
> > 
> > On Sun, Apr 25, 2021 at 4:30 PM Daniel Sun <su...@apache.org> wrote:
> > 
> > > Hi Graeme,
> > >
> > > > Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> > > open jdk.proxy3 to unnamed module @71559e7c
> > >
> > > At a fast glance, "jdk.proxy3" is a dynamic module[1], "Calling
> > > Constructor.newInstance(Object...) on a proxy class in a dynamic module
> > > will throw IllegalAccessException; Proxy.newProxyInstance method should be
> > > used instead". It seem that something goes wrong when Groovy tries to
> > > create proxy for SAM[2]
> > >
> > > [1]
> > > https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/reflect/Proxy.html#dynamicmodule
> > > [2]
> > > https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java#L69-L91
> > >
> > > Cheers,
> > > Daniel Sun
> > > On 2021/04/22 12:24:39, Graeme Rocher <gr...@gmail.com> wrote:
> > > > Hi all,
> > > >
> > > > We are close to getting Micronaut's JDK 16 builds passing however some
> > > > tests are failing that are related to Groovy and Spock that I am unsure
> > > how
> > > > to fix.
> > > >
> > > > Most of the errors are like:
> > > >
> > > > java.lang.reflect.InvocationTargetException
> > > >     at org.codehaus.groovy.vmplugin.v9.Java9.of(Java9.java:160)
> > > >     at
> > > >
> > > org.codehaus.groovy.vmplugin.v9.Java9.getInvokeSpecialHandle(Java9.java:179)
> > > >     at
> > > >
> > > java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
> > > >     at io.micronaut.core.io.WritableSpec.test flush is
> > > > called(WritableSpec.groovy:13)
> > > > Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> > > > open jdk.proxy3 to unnamed module @71559e7c
> > > >     at
> > > >
> > > java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:260)
> > > >     ... 4 more
> > > >
> > > > Which seems to be related to the creation of proxies for closures as the
> > > > code in question that fails looks like:
> > > >
> > > >     @Get(value = "/welcome", produces = MediaType.TEXT_PLAIN)
> > > >     Writable render() { // <2>
> > > >         { writer ->
> > > >             template.make( // <3>
> > > >                     firstName: "Fred",
> > > >                     lastName: "Flintstone"
> > > >             ).writeTo(writer)
> > > >         }
> > > >     }
> > > >
> > > > There is a single other failure with this Spock error message:
> > > >
> > > > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make
> > > > field static final java.lang.invoke.MethodHandles$Lookup
> > > > java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module
> > > > java.base does not "opens java.lang.invoke" to unnamed module @533e0c7
> > > >     at
> > > >
> > > org.spockframework.mock.runtime.DefaultMethodInvoker.respond(DefaultMethodInvoker.java:50)
> > > >     ... 27 more
> > > >
> > > >
> > > > Are these problems something that has been resolved or being looked at? I
> > > > haven't seen anything with a brief look through the issue tracker.
> > > >
> > > > Thanks for the feedback
> > > > --
> > > > Graeme Rocher
> > > >
> > >
> > 
> > 
> > -- 
> > Graeme Rocher
> > 
> 

Re: Groovy with JDK 16

Posted by Daniel Sun <su...@apache.org>.
Hi Graeme,

> is there an issue report to track this or should I file one?

The issue reports were created, and I've already fixed the dynamic proxy related issues in the PR[1].
https://issues.apache.org/jira/browse/GROOVY-10137
https://issues.apache.org/jira/browse/GROOVY-10138

Other issues were found when running on JDK16 too, see http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

P.S. sorry for the late reply. I'm too busy recently to look into issues...


[1] https://github.com/apache/groovy/pull/1598

Cheers,
Daniel Sun
On 2021/05/01 18:53:19, Graeme Rocher <gr...@gmail.com> wrote: 
> Thanks Daniel, is there an issue report to track this or should I file one?
> 
> On Sun, Apr 25, 2021 at 4:30 PM Daniel Sun <su...@apache.org> wrote:
> 
> > Hi Graeme,
> >
> > > Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> > open jdk.proxy3 to unnamed module @71559e7c
> >
> > At a fast glance, "jdk.proxy3" is a dynamic module[1], "Calling
> > Constructor.newInstance(Object...) on a proxy class in a dynamic module
> > will throw IllegalAccessException; Proxy.newProxyInstance method should be
> > used instead". It seem that something goes wrong when Groovy tries to
> > create proxy for SAM[2]
> >
> > [1]
> > https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/reflect/Proxy.html#dynamicmodule
> > [2]
> > https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java#L69-L91
> >
> > Cheers,
> > Daniel Sun
> > On 2021/04/22 12:24:39, Graeme Rocher <gr...@gmail.com> wrote:
> > > Hi all,
> > >
> > > We are close to getting Micronaut's JDK 16 builds passing however some
> > > tests are failing that are related to Groovy and Spock that I am unsure
> > how
> > > to fix.
> > >
> > > Most of the errors are like:
> > >
> > > java.lang.reflect.InvocationTargetException
> > >     at org.codehaus.groovy.vmplugin.v9.Java9.of(Java9.java:160)
> > >     at
> > >
> > org.codehaus.groovy.vmplugin.v9.Java9.getInvokeSpecialHandle(Java9.java:179)
> > >     at
> > >
> > java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
> > >     at io.micronaut.core.io.WritableSpec.test flush is
> > > called(WritableSpec.groovy:13)
> > > Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> > > open jdk.proxy3 to unnamed module @71559e7c
> > >     at
> > >
> > java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:260)
> > >     ... 4 more
> > >
> > > Which seems to be related to the creation of proxies for closures as the
> > > code in question that fails looks like:
> > >
> > >     @Get(value = "/welcome", produces = MediaType.TEXT_PLAIN)
> > >     Writable render() { // <2>
> > >         { writer ->
> > >             template.make( // <3>
> > >                     firstName: "Fred",
> > >                     lastName: "Flintstone"
> > >             ).writeTo(writer)
> > >         }
> > >     }
> > >
> > > There is a single other failure with this Spock error message:
> > >
> > > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make
> > > field static final java.lang.invoke.MethodHandles$Lookup
> > > java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module
> > > java.base does not "opens java.lang.invoke" to unnamed module @533e0c7
> > >     at
> > >
> > org.spockframework.mock.runtime.DefaultMethodInvoker.respond(DefaultMethodInvoker.java:50)
> > >     ... 27 more
> > >
> > >
> > > Are these problems something that has been resolved or being looked at? I
> > > haven't seen anything with a brief look through the issue tracker.
> > >
> > > Thanks for the feedback
> > > --
> > > Graeme Rocher
> > >
> >
> 
> 
> -- 
> Graeme Rocher
> 

Re: Groovy with JDK 16

Posted by Graeme Rocher <gr...@gmail.com>.
Thanks Daniel, is there an issue report to track this or should I file one?

On Sun, Apr 25, 2021 at 4:30 PM Daniel Sun <su...@apache.org> wrote:

> Hi Graeme,
>
> > Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> open jdk.proxy3 to unnamed module @71559e7c
>
> At a fast glance, "jdk.proxy3" is a dynamic module[1], "Calling
> Constructor.newInstance(Object...) on a proxy class in a dynamic module
> will throw IllegalAccessException; Proxy.newProxyInstance method should be
> used instead". It seem that something goes wrong when Groovy tries to
> create proxy for SAM[2]
>
> [1]
> https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/reflect/Proxy.html#dynamicmodule
> [2]
> https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java#L69-L91
>
> Cheers,
> Daniel Sun
> On 2021/04/22 12:24:39, Graeme Rocher <gr...@gmail.com> wrote:
> > Hi all,
> >
> > We are close to getting Micronaut's JDK 16 builds passing however some
> > tests are failing that are related to Groovy and Spock that I am unsure
> how
> > to fix.
> >
> > Most of the errors are like:
> >
> > java.lang.reflect.InvocationTargetException
> >     at org.codehaus.groovy.vmplugin.v9.Java9.of(Java9.java:160)
> >     at
> >
> org.codehaus.groovy.vmplugin.v9.Java9.getInvokeSpecialHandle(Java9.java:179)
> >     at
> >
> java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
> >     at io.micronaut.core.io.WritableSpec.test flush is
> > called(WritableSpec.groovy:13)
> > Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> > open jdk.proxy3 to unnamed module @71559e7c
> >     at
> >
> java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:260)
> >     ... 4 more
> >
> > Which seems to be related to the creation of proxies for closures as the
> > code in question that fails looks like:
> >
> >     @Get(value = "/welcome", produces = MediaType.TEXT_PLAIN)
> >     Writable render() { // <2>
> >         { writer ->
> >             template.make( // <3>
> >                     firstName: "Fred",
> >                     lastName: "Flintstone"
> >             ).writeTo(writer)
> >         }
> >     }
> >
> > There is a single other failure with this Spock error message:
> >
> > Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make
> > field static final java.lang.invoke.MethodHandles$Lookup
> > java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module
> > java.base does not "opens java.lang.invoke" to unnamed module @533e0c7
> >     at
> >
> org.spockframework.mock.runtime.DefaultMethodInvoker.respond(DefaultMethodInvoker.java:50)
> >     ... 27 more
> >
> >
> > Are these problems something that has been resolved or being looked at? I
> > haven't seen anything with a brief look through the issue tracker.
> >
> > Thanks for the feedback
> > --
> > Graeme Rocher
> >
>


-- 
Graeme Rocher

Re: Groovy with JDK 16

Posted by Daniel Sun <su...@apache.org>.
Hi Graeme,

> Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not open jdk.proxy3 to unnamed module @71559e7c

At a fast glance, "jdk.proxy3" is a dynamic module[1], "Calling Constructor.newInstance(Object...) on a proxy class in a dynamic module will throw IllegalAccessException; Proxy.newProxyInstance method should be used instead". It seem that something goes wrong when Groovy tries to create proxy for SAM[2]

[1] https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/reflect/Proxy.html#dynamicmodule
[2] https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/reflection/stdclasses/CachedSAMClass.java#L69-L91

Cheers,
Daniel Sun
On 2021/04/22 12:24:39, Graeme Rocher <gr...@gmail.com> wrote: 
> Hi all,
> 
> We are close to getting Micronaut's JDK 16 builds passing however some
> tests are failing that are related to Groovy and Spock that I am unsure how
> to fix.
> 
> Most of the errors are like:
> 
> java.lang.reflect.InvocationTargetException
>     at org.codehaus.groovy.vmplugin.v9.Java9.of(Java9.java:160)
>     at
> org.codehaus.groovy.vmplugin.v9.Java9.getInvokeSpecialHandle(Java9.java:179)
>     at
> java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
>     at io.micronaut.core.io.WritableSpec.test flush is
> called(WritableSpec.groovy:13)
> Caused by: java.lang.IllegalAccessException: module jdk.proxy3 does not
> open jdk.proxy3 to unnamed module @71559e7c
>     at
> java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:260)
>     ... 4 more
> 
> Which seems to be related to the creation of proxies for closures as the
> code in question that fails looks like:
> 
>     @Get(value = "/welcome", produces = MediaType.TEXT_PLAIN)
>     Writable render() { // <2>
>         { writer ->
>             template.make( // <3>
>                     firstName: "Fred",
>                     lastName: "Flintstone"
>             ).writeTo(writer)
>         }
>     }
> 
> There is a single other failure with this Spock error message:
> 
> Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make
> field static final java.lang.invoke.MethodHandles$Lookup
> java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module
> java.base does not "opens java.lang.invoke" to unnamed module @533e0c7
>     at
> org.spockframework.mock.runtime.DefaultMethodInvoker.respond(DefaultMethodInvoker.java:50)
>     ... 27 more
> 
> 
> Are these problems something that has been resolved or being looked at? I
> haven't seen anything with a brief look through the issue tracker.
> 
> Thanks for the feedback
> -- 
> Graeme Rocher
>