On 16/11/2016 10:25, [email protected] 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.

:
Yes, jlink doesn't do that, but my tool on top of jlink does it :)
But as i said above, if the information given by 'uses' do not allow to do 
static analysis like finding the root modules (services included), it perhaps 
means that 'uses' doesn't worth its own weight.
jlink could do service binding (s/resolveRequires/resolveRequiresAndUses) but all the initial feedback was that people wanted the minimum number of modules in the image. It's not hard to have jlink make some suggestions, it just hasn't been implemented (this is what the open issue in JEP 282 is about).

-Alan

Reply via email to