On 16/11/2016 19:41, [email protected] wrote:
:
My point is that in teory, that's cool but in reality the module-info of
java.base (or java.sql) declares a lot of 'uses' making the whole idea moot.
To avoid java.base to use 'uses', we need a way to be able to have a way to
delegate the power of the ServiceLoader to another code, so the other code will
have to use 'uses'.
If a consumer is making use of an API in java.base and the
implementation of that API makes use of services under the covers then
it is transparent to the consumer of the API. The consumer of the API
shouldn't need to know anything about the "SPI" types and would be very
surprising if the user of an API needed to declare `uses` on such types.
In the JDK then I'm only aware of two cases where the consumer passes a
service type to an API that doesn't know anything about the service type
(the two cases are JVMCI and a utility method in javac). Both of these
cases use addUses to get through the hygiene check.
jlink is a bit special in that the user of the tool needs at least some
global knowledge when choosing the service provider modules to include
in the run time image. As I said, the tool could help more but having it
do eager service binding is problematic as it tends to maximize rather
than minimize the number of the modules.
-Alan.