Instrumentation.redefineModule -- extraPackages argument?

Alan Bateman Alan.Bateman at oracle.com
Mon Mar 13 12:20:54 UTC 2017


On 13/03/2017 11:43, Peter Levart wrote:

>
> ...but then those Module(s) in the new Layer are reachable from 
> Class(es) defined in them and those Class(es) are reachable from the 
> common ClassLoader (ClassLoader.classes Vector). Until all classes 
> defined by the ClassLoader (from various Layer(s)) become unreachable, 
> none of the Layer(s) can be unloaded.
>
> Am I right? Is package-private ClassLoader.addClass(Class) invoked by 
> VM to record every loaded class or just every class loaded into 
> unnamed module?
Every class (ignoring VM anonymous classes) is kept alive by its 
defining class loader. So if you have several layers of modules with the 
modules in all layers defined to the same class loader then be won't 
become illegible to be GC'ed and unloaded until they are all 
unreachable. This shouldn't be a surprise of course.

-Alan


More information about the jigsaw-dev mailing list