uses is useless ?
David M. Lloyd
david.lloyd at redhat.com
Wed Nov 16 14:00:14 UTC 2016
On 11/16/2016 04:44 AM, Alan Bateman wrote:
> On 16/11/2016 10:25, forax at univ-mlv.fr wrote:
>
>> :
>> The whole point of uses is to enable a kind of static analysis on the
>> service dependencies,
>> if 'uses' is not required, if you can easily bypass it or it doesn't
>> provide useful information,
>> then it should be removed from the spec.
> `uses` is used to link the consumers of services to the providers of
> services. If nobody `uses S` then the modules that `provides S with ...`
> will not be resolved (assuming nobody directly depends on these service
> provider modules).
>
> The scenario where a framework uses ServiceLoader on behalf of a
> consumer really needs the consumer to declare that it uses the service
> type, otherwise there is no guarantee that the modules that provide
> implementation of the service will be resolved.
That's really a usability regression though, isn't it? In the past, I
could always use ServiceLoader with a ClassLoader argument to specify on
whose behalf I'm loading. In fact we do this quite a lot today.
--
- DML
More information about the jigsaw-dev
mailing list