Should ClassLoader::getResouces return the same resource twice?

Alan Bateman Alan.Bateman at oracle.com
Mon Jan 4 08:41:21 UTC 2021


On 03/01/2021 13:10, Thiago Henrique Hupner wrote:
> :
>
> I hope made it a little more clear. By now it is clear that it is loading
> the same
> resource twice because the same jar is in the classloader and in the module
> layer
> classloader.
If I read your mail correctly you've got a class path today and you want 
to "move" the well behaved components to a module path, leaving the 
remaining the components that can't work as automatic modules on the 
class path. It's equivalent to specifying both a module path and class 
path to the java command line launcher. You also mention that you have 
to use a custom class loader. If that class loader were updated to 
support modules and load classes into its unnamed module then you should 
be able to get this to work. This is very advanced territory and would 
be approximately equivalent to the application class loader in the JDK 
where it supports both modules and the class path. I don't think your 
current approach of using a URLClassLoader as a parent will work as it 
doesn't support the bidirectional delegation that would be need to get 
this to work.

-Alan.


More information about the jigsaw-dev mailing list