Mark, thanks a lot for your thorough reply.
The CDI-1.0 spec is defined for [...] what does happen if the injection point type is generic but the bean type is raw or unbound.
And there's the generic method producer of course. So for the producer there are three options:
public ParamValue produce(InjectionPoint injectionPoint)
public ParamValue<?> produce(InjectionPoint injectionPoint)
Generic method with type parameter:
public <V> ParamValue<V> produce(InjectionPoint injectionPoint)
But there is no way with the current wording to do it the other way around:
@Inject Stable<Horse> horseStable;
@Inject Stable<Pig> pigStable;
with a single producer method @Produces <PET> Stable<PET>
Indeed, with both CDI 1.0 and CDI 1.1 this seemingly obvious thing seems to be impossible. Despite not being specified, for CDI 1.0 implementations using the "hack" where the producer returns a raw type seems to work with Weld, OpenWebBeans and CanDI. Unfortunately for CDI 1.1 implementations this doesn't work, as Weld 2.0 doesn't work with it.
If it would be only me, then I'd really ditch this paragraph again and do it properly, which means we need to introduce a multi-pass approach as this imo prevents us from providing such a 'generic' producer method which takes the type info from the InjectionPoint.
There are probably some intricate details I'm not aware of, but that sounds really good to me. Unfortunately Java EE 7 was just released and it thus will be a long time for a new CDI 1.2 will see the light of day. For utility libraries or applications that need to be compatible with CDI 1.0, 1.1 and the upcoming 1.2 it will be really hard if not impossible to have a single producer method that works on all 3 versions.
Is OWB 1.2.1 btw going to be a CDI 1.1 implementation, or still a CDI 1.0 one but with some 1.1 semantics?