On 18.09.2016 15:03, Remi Forax wrote:


------------------------------------------------------------------------

    *De: *"Cédric Champeau" <cedric.champ...@gmail.com>
    *À: *dev@groovy.apache.org
    *Envoyé: *Dimanche 18 Septembre 2016 14:39:30
    *Objet: *Re: TeamCity back on track

    I can confirm this is a new error. Gradle 3.0 works with b119, but
    not b136. And from what I can see, this is *not* going to be trivial
    to fix. Best I could get now is:
    Caused by: java.lang.IllegalAccessException: class
    org.gradle.internal.reflect.JavaMethod cannot access a member of
    class java.lang.ClassLoader (in module java.base) with modifiers
    "protected"
             at
    
java.base/jdk.internal.reflect.Reflection.throwIllegalAccessException(Reflection.java:405)
             at
    
java.base/jdk.internal.reflect.Reflection.throwIllegalAccessException(Reflection.java:396)
             at
    
java.base/jdk.internal.reflect.Reflection.ensureMemberAccess(Reflection.java:98)
             at
    
java.base/java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:359)
             at
    
java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:351)
             at java.base/java.lang.reflect.Method.invoke(Method.java:529)
             at
    org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:77)

    Which is f* annoying.
[...]
This one is a new bug/feature,
it's part of what we have called 'stronger' (not strong) encapsulation
i.e. most of the classes of java.* disallow setAccessible, before that
only internal packages were disallowing setAccessible.

so setAccessible is forbidden, but a subclass from a different module can access the method... strange new rules. Anyway... was there a thread on jigsaw-dev about this? I would like to reread the proposal

For your specific bug, you can use ClassLoader.getDefinedPackages() or
classloader.getUnamedModule().getPackages() instead.

of course with the disadvantage that these are JDK9 only methods.

bye Jochen

Reply via email to