Restrictions on service loading
David M. Lloyd
david.lloyd at redhat.com
Fri Dec 9 14:59:57 UTC 2016
It doesn't seem clear whether this is a spec or implementation issue, so
I'm posting here to start.
The gist of the problem is, code running in a module cannot use
ServiceLoader to find things that it hasn't been declared to "use" even
if a target class loader is specified. This doesn't really make a lot
of sense because in the case where you're specifying a class loader, you
are pretty clearly establishing that you want to search the class
loader, not a module space.
This can be worked around by adding a "uses" at run time, but it
shouldn't be necessary for the explicit class loader case.
More information about the jpms-spec-observers