dev@glassfish.java.net

Re: [v3] exporting all Metro packages for OSGi

From: Bill Shannon <bill.shannon_at_sun.com>
Date: Thu, 21 Aug 2008 14:18:48 -0700

Craig L Russell wrote:
> The only way ServiceLoader can load the class is to do a
> getResource("META-INF/foo") from a ClassLoader that has the jar in its
> resource path.
>
> So it makes sense to me that ServiceLoader should use the same
> ClassLoader for both getResource("META-INF/foo") and
> loadClass("com.sun.fooservice.Foofactory").

I guess I need to understand exactly what the JVM module support
would control.

Today it's true that I can request that private classes be loaded
in another class loader, even though I won't be able to use the class
once its loaded. I suppose the same could be true for module-private
classes.

But doesn't ServiceLoader need to instantiate an instance of the class?
Would it be able to do that if the class were private (in a way that
the JVM enforced)?