Groovy with Jigsaw
Stephen Colebourne
scolebourne at joda.org
Fri Sep 11 09:37:10 UTC 2015
I tried compiling OpenGamma via maven and ran into this straight away:
java.lang.VerifyError: class com.google.common.reflect.Element
overrides final method
java.lang.reflect.AccessibleObject.setAccessible(Z)V
at java.lang.ClassLoader.defineClass1(java.base at 9.0/Native Method)
at java.lang.ClassLoader.defineClass(java.base at 9.0/ClassLoader.java:820)
at java.security.SecureClassLoader.defineClass(java.base at 9.0/SecureClassLoader.java:152)
The Guava code is:
@Override public final void setAccessible(boolean flag) throws
SecurityException {
accessibleObject.setAccessible(flag);
}
So yes, looking at alternative ways to make that method final is
probably an essential.
Stephen
On 11 September 2015 at 10:33, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> On 11/09/2015 10:21, Jochen Theodorou wrote:
>>
>>
>> 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
>
> Okay, I mis-read one of the mails and assumed that setAccessible was failing
> and leading to other errors.
>
> In the current builds then setAccessible is final, and yes, this is an
> incompatible change. The reason for this is that the method is now @CS. I
> think we need to consider changing this so that setAccessible is overridden
> in the final Field, Constructor, and Method classes instead.
>
> -Alan
More information about the jigsaw-dev
mailing list