The split package problem
Alessio Stalla
alessiostalla at gmail.com
Fri Nov 4 09:33:36 UTC 2016
Also, I think there is a problem related to how class loading works. In the
vanilla world of Java apps with a single classloader, if you load classes
in the same (source) package from different sources, the end up in the same
(runtime) package. But if you have different classloaders at play, and load
a class p.C1 from classloader 1 and p.C2 from classloader 2, even if they
share the same (source) package, p, they end up in different (runtime)
packages, let's call them p(1) and p(2). Therefore, C2 cannot access the
protected members of C1. That can be confusing.
On 4 November 2016 at 10:22, Jochen Theodorou <blackdrag at gmx.org> wrote:
> On 04.11.2016 09:25, Remi Forax wrote:
>
>> There are two issues with split packages,
>> - if you have the same class in each part of the package, the behavior of
>> your problem depend on the order in the classpath,
>> i've experienced this kind of bugs with two different libraries
>> requiring different version of ASM, at runtime, a class of the older
>> version was calling a class of the newer version :(
>> - security, if you allow split packages, you allow anybody to insert any
>> classes in any packages.
>>
>
> ok, not sure if I agree that these are reason enough for the annoyance,
> but at least I know the proper reason now ;)
>
> bye Jochen
>
More information about the jigsaw-dev
mailing list