reasons to add readability edges when creating layer

Michał Zegan webczat_200 at poczta.onet.pl
Sun Dec 31 16:06:15 UTC 2017



W dniu 31.12.2017 o 16:54, Alan Bateman pisze:
> On 31/12/2017 01:22, Michał Zegan wrote:
>> Hi.
>>
>> Wondering about one thing: What is the example use for addReads method
>> of ModuleLayer.Controller?
> Code generation or new reflection (java.lang.invoke) would be reasons to
> use addReads.
> 
>> Reflection does not require adding readability edges manually.
>> Also, if readability edge's target module would not be in a parent layer
>> or the same layer, seems that the module class loader will not take into
>> account readability edge changes. Not even sure if it would do this in
>> case when target module would indeed be in the parent layer.
>> So, is the only use case the one when I would have a custom class loader
>> loading by different rules?
>>
> If the container is injecting code into a module m1 with references to
> m2, and if m1 and m2 are mapped to different loaders, then the container
> will need to augment the class loader delegation to support the new read
> edge. There isn't any API support for this so it would require the
> container to support the module layer with its own class loaders (which
> I think is what you are asking).
Is that planned to be added? Or even needed? I wanted to compare jpms
api to jboss-modules and seems to me that jboss-modules does not have
the dependency modification capability at all at the first glance.
Also, would the default module class loader be able to catch new read
edges if the target module was in a parent layer? Not sure how it maps
packages to modules...
> 
> -Alan
> 
> 
> 
> 



More information about the jigsaw-dev mailing list