Groovy with Jigsaw
Jochen Theodorou
blackdrag at gmx.org
Fri Sep 11 09:21:43 UTC 2015
Am 11.09.2015 10:16, schrieb Alan Bateman:
> On 11/09/2015 08:47, Cédric Champeau wrote:
>> For what it's worth, the issue that triggered this conversation is the
>> one reported by Uwe. For Groovy we have a chicken and egg problem for
>> testing, because this change breaks Groovy, and Groovy uses Gradle to
>> build. Since Gradle itself uses Groovy, we have no compatible build
>> tool to test the fix... So it's very problematic. Also the build that
>> we set up failed with:
>>
>> [23:53:08]W:[Gradle failure report] Caused by: java.lang.VerifyError:
>> class com.google.common.reflect.Element overrides final method
>> java.lang.reflect.AccessibleObject.setAccessible(Z)V
>> [23:53:08]W:[Gradle failure report] at
>> java.lang.ClassLoader.defineClass1(java.base at 9.0/Native Method)
>> [23:53:08]W:[Gradle failure report] at
>> java.lang.ClassLoader.defineClass(java.base at 9.0/ClassLoader.java:820)
>> [23:53:08]W:[Gradle failure report] at
>> java.security.SecureClassLoader.defineClass(java.base at 9.0/SecureClassLoader.java:152)
>>
>> Which indicates the change to setAccessible also broke Guava, which is
>> used by Gradle. So it's going to be very complicated to even try to
>> fix the issue in those conditions. Anyway, it doesn't seem a good idea
>> to introduce a new exception type. Even if it is semantically a bit
>> problematic, wouldn't make ReflectiveOperationException a subclass of
>> SecurityException an option?
> The right exception for this case might need more consideration but I
> assume the underlying issue must be a failed attempt to get access to a
> member of a type in a non-exported package.
>
> Is there any way to run this with -Dsun.reflect.debugModuleAccessChecks
> to see if you get any stack traces to debug this?
the error in Guava is not a failed attempt, it is a VerifyError, because
AccessibleObject#setAccessible is now final and
com.google.common.reflect.Element overrides the method.
As far as I have seen Guava makes a parallel reflective structure of a
class to be able to better handle them. A the same time they proxy to
their counter parts, but do also implement interfaces like Member. That
requires for example to override setAccessible, which will just make the
same call on the delegate. I don't see how they can easily fix that
without giving up their mirror structure and have it exchangeable with
the java reflective classes at the same time. But I am not on the guava
team, so they know hopefully better
bye blackdrag
--
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/
More information about the jigsaw-dev
mailing list