ServiceLoader.load* take 2
Jesse Glick
jesse.glick at oracle.com
Tue Jun 12 14:16:33 PDT 2012
On 06/12/2012 05:01 PM, David M. Lloyd wrote:
> It seems like a specific behavior is the goal, but what is the purpose of the behavior?
That the customary invocation of ServiceLoader load service provider classes from all eligible modules in the current configuration, whether or not the caller's module
and/or the "main module" happen to have a direct or indirect dependency on that provider module. If you want this behavior and want to use the original SL behavior based
on TCCL, then this TCCL has to return every possible result from getResources("META-INF/services/svc.Name") and be able to load every class thus named - or, given my
proposed new API in ClassLoader, has to return every possible (URL,ClassLoader) pair from all loaded modules. A regular module class loader would not have such behavior -
it would only "see" resources & classes from the associated module and exported packages from its declared dependencies.
More information about the jigsaw-dev
mailing list