On 09/15/2016 05:51 PM, Alan Bateman wrote:
On 15/09/2016 07:54, Peter Levart wrote:

One thing that is not clear is whether the yyy in "provides xxx with yyy" directive of module declaration must be a concrete class and a subtype of service type when the service is obtained via a static method. For example, is the following a valid configuration: Service type A, implementation class B (a subtype of A), static method declared in C (unrelated to A) with return type B (or A or anything between A and B?).
If yyy defines the static factory method then it does not need to be a sub-type of xxx, the return type from the public provider() method just needs to be xxx or a sub-type of. So the example is okay, no need for C to extend/implement A.

I should note that the implementation isn't aligned with this yet but there are updates to both javac and SL coming that will align it with the current proposal.

-Alan

...so yyy can be any class or interface. It's provider() method can even instantiate and return an instance of some class that is not part of the module that provides the service. Hm...

Regards, Peter

Reply via email to