users@hk2.java.net

Use of ContractsProvided? Indicating a Contract with an Annotation

From: buko <buko_at_chiubarobot.com>
Date: Fri, 3 Jan 2014 01:04:07 -0500

I have several interfaces in my domain and I'd like to provide hk2-aware
implementations of said interfaces. But I'd rather not annotate such key
domain interfaces with @Contract since it leaks implementation into the
domain. I had thought @ContractsProvided provided a very nice way around
this -- on the implementation class I could explicitly indicate a certain
interface was a contract an provided by this component. But this does
doesn't work at all. It seems @ContractProvided still requires the actual
interface to be marked as a @Contract.

Maybe ContractProvided is not the right way to do this but how can I
indicate a certain interface is supplied by a component via an annotation?
This stems from a strong desire to be able just use
addActiveDescriptor(Component.class) in binders and not have to use
explicit bind syntax.