groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remi Forax <fo...@univ-mlv.fr>
Subject Re: TeamCity back on track
Date Sun, 18 Sep 2016 14:59:32 GMT
It's a feature, 
so you can easily detect sofwares that try to do reflection using setAccessible, i.e. violates
the VM access rules to, by example, get access to a security token, 
what is not known is which part of the JDK should allow this kind of reflection (think things
like sun.misc.Unsafe.theUnsafe). 

It works like with the exports feature, you can use the command line flag --add-exports-private
which works like --add-exports 

Rémi 

> De: "Cédric Champeau" <cedric.champeau@gmail.com>
> À: dev@groovy.apache.org
> Envoyé: Dimanche 18 Septembre 2016 15:13:17
> Objet: Re: TeamCity back on track

> Thanks but I'm afraid it won't allow me to boot Gradle either. Even after trying
> `getDefinedPackages` instead, I only reach another error of this kind:
> Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private
> final java.util.Map java.util.Collections$UnmodifiableMap.m accessible: module
> java.base does not "exports private java.util" to unnamed module @6da21078
> at
> java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:414)
> at
> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:196)
> at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
> at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
> at
> net.rubygrapefruit.platform.internal.WrapperProcess.getEnv(WrapperProcess.java:110)

> Is this "feature/bug" going to be fixed? Is there any way to disable that
> behavior?

> 2016-09-18 15:03 GMT+02:00 Remi Forax < forax@univ-mlv.fr > :

>>> De: "Cédric Champeau" < cedric.champeau@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.

>> Sorry,wrong stacktrace.

>> 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.

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

>> Rémi

>>> 2016-09-18 13:46 GMT+02:00 Cédric Champeau < cedric.champeau@gmail.com >
:

>>>> This seems to be a new error, I've never seen it before with Gradle 3.0+.
It
>>>> says:
>>>> [Gradle failure report] Caused by:
>>>> java.lang.reflect.InaccessibleObjectException: Unable to make protected
>>>> java.lang.Package[] java.lang.ClassLoader.getPackages() accessible: module
>>>> java.base does not "exports private java.lang" to unnamed module @6ca18a14
>>>> [12:00:28][Gradle failure report] at
>>>> java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:414)
>>>> [12:00:28][Gradle failure report] at
>>>> java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:196)
>>>> [12:00:28][Gradle failure report] at
>>>> java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:192)
>>>> [12:00:28][Gradle failure report] at
>>>> java.base/java.lang.reflect.Method.setAccessible(Method.java:186)
>>>> [12:00:28][Gradle failure report] at
>>>> org.gradle.internal.reflect.JavaMethod.<init>(JavaMethod.java:34)
>>>> [12:00:28][Gradle failure report] at
>>>> org.gradle.internal.reflect.JavaMethod.<init>(JavaMethod.java:38)
>>>> [12:00:28][Gradle failure report] at
>>>> org.gradle.internal.reflect.JavaReflectionUtil.method(JavaReflectionUtil.java:224)
>>>> [12:00:28][Gradle failure report] at
>>>> org.gradle.internal.classloader.FilteringClassLoader.<clinit>(FilteringClassLoader.java:49)

>>>> Which doesn't seem to be URLClassLoader related.

>>>> 2016-09-18 13:11 GMT+02:00 Remi Forax < forax@univ-mlv.fr > :

>>>>> Gradle thinks it can hack the classpath by seeing the application classloader
as
>>>>> an URLClassLoader.
>>>>> The application classloader is now something that loads modules, so it's
not a
>>>>> subclass of URLClassLoader anymore.

>>>>> Rémi

>>>>> ----- Mail original -----
>>>>> > De: "Jochen Theodorou" < blackdrag@gmx.org >
>>>>> > À: dev@groovy.apache.org
>>>>> > Envoyé: Dimanche 18 Septembre 2016 12:31:56
>>>>> > Objet: Re: TeamCity back on track

>>>>> > On 18.09.2016 10:47, Cédric Champeau wrote:
>>>>> >> I just installed Jigsaw b136. Let me know if it helps.

>>>>> > looks like gradle has a problem with this one as well

>>>>> > bye Jochen

Mime
View raw message