Mandatory service requirement

Alan Bateman Alan.Bateman at oracle.com
Fri Feb 17 07:23:33 PST 2012


On 16/02/2012 15:07, Jesse Glick wrote:
>
> Consider just dropping mandatory service requirement, i.e. let a 
> module which declares that it requires a particular service just load 
> whatever providers happen to be available for other reasons, such as 
> because an overarching "application" module required the providing 
> module directly (I suppose like what "requires optional service" would 
> do).
For cases where there isn't a default/fallback implementation and where 
any provider implementation will suffice, then I think it would be 
preferable to catch such issues at install time rather than failing at 
runtime.

> :
>
> For that matter, you could probably drop the need to declare that a 
> service is used at all: if and when ServiceLoader is called, determine 
> the providers - if not precomputed in the repository - and load them. 
> Of course you cannot compatibly reverse this decision, since older 
> modules might "unexpectedly" load a service and there is no way of 
> upgrading them except to grep the sources for calls to 
> ServiceLoader.load(Literal.class) under the assumption that this is 
> the only calling pattern.
>
I'm not following here, this is a static module system and so the 
modules that are providing the service need to involved when generating 
the configuration.

-Alan.



More information about the jigsaw-dev mailing list