JDK 9 Early Access with Project Jigsaw, build 135 on 09-14-2016 (#5500)
Claes Redestad
claes.redestad at oracle.com
Sun Oct 2 12:43:22 UTC 2016
On 2016-10-02 14:26, Jochen Theodorou wrote:
>
>> Do you know anything about the ClassLoader::getPackages issue? Is this a
>> case where the (new) public getDefinedPackages returns the Packages that
>> Gradle is looking for?
>
> hmm... if I look at
> https://github.com/gradle/gradle/blob/master/subprojects/base-services/src/main/java/org/gradle/internal/classloader/MultiParentClassLoader.java
> and I imagine one parent being a MultiParentClassLoader...
> getDefinedPackages is final, so you cannot do what they did for
> getPackages, unless you do it from outside. And for that you need to
> know about multiple parents... I don´t know if it is working well enough
> for Gradle, but no, getDefinedPackages is no suitable replacement for
> getPackages at all if you have to consider multiparent class loaders.
Since the methods reflected upon in ClassLoader here are all protected,
couldn't this specific code be made reflection-free by wrapping all
parent classloaders in a delegating classloader that overrides
getPackage/getPackages as public?
/Claes
More information about the jigsaw-dev
mailing list