Should ClassLoader::getResouces return the same resource twice?
Thiago Henrique Hupner
thihup at gmail.com
Mon Jan 4 11:38:45 UTC 2021
Yes, that's exactly it. Sorry for all the noise in the previous emails.
I'm not using a URLClassLoader in my application, I've only used it
as an example because it is very easy to override to return a specific
value (and not have to implement all the other methods).
So, I guess I will need to have a look at the application classloader
and update my current classloader to be able to do the bidirectional
delegation. Do you have any recommendations about where to look?
Thanks!
Em seg., 4 de jan. de 2021 às 05:48, Alan Bateman <Alan.Bateman at oracle.com>
escreveu:
> 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