Hi,
I'm running some tests locally using OWB and Instance objects. I noticed
that when the injection point is Instance<Foo> and I attempt to get an
injectable reference to the InjectionPoint, I get a very odd value for
InjectionPoint.getType(). As far as I understand it, this value should be
the type being injected into, e.g. Foo in my case. What I actually get
back is the value of Bean.getBeanClass(). That makes very little sense.
As best as I can tell, the following code snippet is the cause:
if (ParameterizedType.class.isInstance(type))
{
ParameterizedType parameterizedType =
ParameterizedType.class.cast(type);
if (parameterizedType.getRawType() == Instance.class)
{
Bean<InjectionPoint> bean =
creationalContextImpl.getBean();
return new InjectionPointDelegate(
injectionPoint,
bean.getBeanClass() != null ?
bean.getBeanClass() : parameterizedType.getActualTypeArguments()[0]);
}
}
The problem is that Bean.getBeanClass() can never be null, by definition,
but also should not be used for type safe resolution (we actually had a
discussion about this on the EG list as I had the opposite belief). But I
do believe that the else value is in fact what should always be used, I
always should be getting the expected parameterized value.
If you guys agree, I can submit a patch to fix this.
John