Proposed enhancement to Layer API

Alan Bateman Alan.Bateman at
Thu Jan 5 12:23:46 UTC 2017

On 04/01/2017 15:15, Thomas Watson wrote:

> :
> In theory fragments can be dynamically attached to an already resolved 
> host (module) which implies that we need to be able to dynamically add 
> packages to the existing host module.  With that in mind, if we wanted 
> to support dynamic attachment of fragments then the ability to add 
> packages would also be useful to me.
I'm curious what the typical use-case is for this. Most of time that 
I've seen discussions on fragments then it was about adding i18n 
resources but there are other ways to do that sort of thing (i18n 
bundles can be deployed as service provider modules for example). An 
approximate equivalent of fragments here is patching where code is 
compiled or run "as if" it's part of a host module. This is important 
for tests that are in the same package as the API under test or other ad 
hoc patching or testing needs where classes or resources in a module 
need to be overridden.

In any case, exposing an API to add packages dynamically has a number of 
implications. To date then the layer API wasn't really intended to 
create layer with a single larval module so I think we would need 
conclusions on this topic on the JSR list but putting in support for that.


More information about the jigsaw-dev mailing list