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)?