Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.9
-
None
-
None
-
Groovy 3.0.9, Amazon Corretto 17.0, Windows 10 Enterprise, German, x64
Description
Given:
- A functional interface `IStillFunctional` with a method `foo` and a default-method `bar`.
- A java method `doConsume(IStillFunctional)` (defined in a Java-Class)
I get an `IllegalAccessException` when I pass a Closure to the `doConsume` method and then call the default-method `bar`.
Stacktrace:
Caught: java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at jdk.proxy2/jdk.proxy2.$Proxy18.bar(Unknown Source) at com.Consumer2.doConsume(Consumer2.java:6) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at com.GroovyMain.run(GroovyMain.groovy:3) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at com.GroovyMain.main(GroovyMain.groovy) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) Caused by: java.lang.IllegalAccessException: module jdk.proxy2 does not open jdk.proxy2 to unnamed module @51565ec2 ... 19 more
I attached a minimal project with this issue to the ticket.
Observations:
- The issue seems to happen in org.codehaus.groovy.runtime.ConversionHandler#invoke.
- The issue does not happen when the Consumer-Class is defined in a Groovy file.
- The issue did not occur under JDK 11