ClassLoader.getParent to throw exception for module classloader

Alan Bateman Alan.Bateman at oracle.com
Fri Jun 22 02:35:29 PDT 2012


On 22/06/2012 01:00, David Holmes wrote:
>
> So that would seem to have far-reaching consequences on various bits 
> of code that check the classloader hierarchy to determine when they 
> need to do security manager checks.
>
> This leaves me wondering how custom classloaders fit into this world - 
> do they have a parent that is a module loader?
The parent is determined when creating a class loader and I suspect it 
will be common that a module class loader will be a parent. There are 
lots of other issues that arise when there are module and non-module 
class loaders in the same fish tank and these will have to be worked out.

I think the notion of a single parent class loader is somewhat dated 
now. For a long time there has been enterprise apps and frameworks that 
delegate to multiple parents and lots of configurations where there are 
graphs of class loaders. In any case, if there is code that is assuming 
a hierarchy and is using getParent to walk the hierarchy, maybe to find 
a specific loader, then it may not work as expected with modules. For 
that reason having getParent throw UOE would help identify the code that 
needs to be changed.

As regards the JDK and the usages that are there for security reasons 
then these can be changed. I don't know if there is much of this kind of 
thing outside of the core platform.

-Alan.



More information about the jigsaw-dev mailing list