Need help implementing Java modules

Ralph Goers rgoers at apache.org
Wed May 10 13:38:39 UTC 2017


> On May 9, 2017, at 11:50 PM, Remi Forax <forax at univ-mlv.fr> wrote:
> 
> 
> 
> On May 10, 2017 2:20:31 AM GMT+02:00, Ralph Goers <rgoers at apache.org <mailto: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.
> 
> 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.
> 
>> 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.
> 
>> 
>> Thanks,
>> Ralph
> 
> cheers,
> Rémi 

If log4j-core is an automatic module is it still required to call addReads()? I would think not since it isn’t really a module. Would the module with the plugin still have to declare its package as open?

It is almost certain that many of our jars will have to be automatic modules at least to start because none of the dependencies we use have indicated that they are going to support JPMS yet (no great surprise there since the spec isn’t final).

Ralph


More information about the jigsaw-dev mailing list