Proposal: #ServiceLoaderEnhancements

mark.reinhold at mark.reinhold at
Tue Sep 13 20:04:38 UTC 2016

2016/9/12 15:08:41 -0700, Stephen Colebourne <scolebourne at>:
> My preference of these three options is option 2.

Sorry if I wasn't clear, but this isn't meant to be a "choose one"
proposal.  It's a set of check boxes, not radio buttons.  The proposal
is to implement suggestions (2) and (3) of your original comment, as
captured and labeled in the issue text, but not (1).

>                                                   However, I would
> prefer to see the method name be defined by the module definition as
> previously suggested [1]:
> module {
>  provides java.sql.Driver with com.mysql.jdbc.Driver::instance;
> }
> This would allow ::staticMethod or ::staticConstant, and avoid
> hard-coding "provider" as a special method name.
> (For my motivating use case, the Chronology classes of ThreeTen-Extra
> [2] it would be distracting to have a method named provider(). While a
> separate class in a non-exported package would be possible to hold the
> provider() method, as a solution that seems like overkill relative to
> the syntax above.)

The semantics of the `::` syntax as it already exists is tightly bound
up with type inference.  Also, it can only be used to refer to methods,
not fields, so it'd have to be extended to support `::staticConstant`.

Working out the details is not impossible, but it's certainly far from
trivial.  It's not clear to me that, even with more time, it should be
at the top of our priority list.

- Mark

More information about the jigsaw-dev mailing list