Instrumentation.redefineModule -- extraPackages argument?

Alan Bateman Alan.Bateman at
Sat Mar 11 20:17:31 UTC 2017

On 11/03/2017 15:12, Michael Rasmussen wrote:

> Yes, you are correct that the current implementation doesn't update
> the classloader's mapping of package -> module.
> But I did a quick and dirty test/hack, calling addPackage on the
> Module, and then registering the package in the classloader.
> After that, Class.forName successfully loaded the class, it was
> defined in to the correct module, and it could access non-exported
> members of that module!
Adding packages dynamically (which is just one part of dynamically 
evolving a module) would touch several areas. Introducing a class loader 
capability is just one, there are also several issues around resources 
and resource encapsulation. There are issues around doing this 
atomically and of course all the same error cases that creating a layer 
has to deal with. In all, this is beyond what 
Instrumentation.defineModules was intended to do.


More information about the jigsaw-dev mailing list