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 <graeme.roc...@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 >