Need help implementing Java modules

Alex Buckley alex.buckley at oracle.com
Wed May 10 18:44:18 UTC 2017


On 5/9/2017 11:50 PM, Remi Forax wrote:
> On May 10, 2017 2:20:31 AM GMT+02:00, Ralph Goers <rgoers at apache.org>
> wrote:
>> With all this in mind, if users create modules will they be
>> required to declare the packages where they have created plugins as
>> “open” to log4j for this to work?
>
> It depends if when you call the static method you need to bypass the
> encapsulation or not i.e. if your current code uses setAccessible,
> yes, the plugin's module has to be opened.

Yes; I'll talk about that in a parallel mail.

> In any case, you need to add a read edge at runtime from log4j to the
> plugin, otherwise you will not find the plugins class.

No need for a reads edge. If you're using Core Reflection to instantiate 
classes and access their members, then you're subject to class loader 
visibility (which is the same as in JDK 8) and module accessibility 
(hence the need to open or export the plugin package), but readability 
comes for free.

>> I am assuming that Log4j will be able to access this module without
>> having to declare a dependency on it?
>
> yes, if you add a read edge at runtime.

No need for that.

Alex


More information about the jigsaw-dev mailing list