Ahh i see!
To be honest, i'm not very experiences in this area too!
I tried it with this code:
AnnotatedType<? super C> annotatedToSpecialize =
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(getAnnotated().getJavaClass().getSuperclass());
while
(annotatedToSpecialize.isAnnotationPresent(Specializes.class))
{
annotatedToSpecialize =
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(annotatedToSpecialize.getJavaClass().getSuperclass());
}
defineName(annotatedToSpecialize,
WebBeansUtil.getManagedBeanDefaultName(annotatedToSpecialize.getJavaClass().getSimpleName()));
and its working fine too.
All unit tests passing.
Should i commit it?
2013/12/18 Joseph Bergmark <[email protected]>
> Sorry, I'll try to be more clear. Again, I'm not very experienced in this
> area of OWB, so my interpretation could be wrong or this could be handled
> in a different code path entirely.
>
> The new code is looking directly at the Class itself for the @Specializes
> annotation. I'm suggesting that perhaps instead it should be looking at
> the AnnotatedType for the annotation (AnnotatedType.isAnnotatationPresent)
> in case a portable extension has called setAnnotatedType during a
> ProcessAnnotatedType event and has added @Specializes.
>
>
> On Wed, Dec 18, 2013 at 4:14 PM, Thomas Andraschko <
> [email protected]> wrote:
>
> > Hey,
> >
> > i'm not exactly sure if understand your question correctly but i will
> > explain you my code change.
> >
> > I think specialization per se was working fine but the old code just
> looked
> > for a @Named on the direct parent.
> >
> > e.g.
> >
> > @Named BeanA
> > @Specializes BeanB extends BeanA
> > @Specializes BeanC extends BeanC
> >
> > It tried to extract the name for BeanC from BeanB but actually it must
> look
> > for @Named on BeanA.
> >
> >
> > 2013/12/18 Joseph Bergmark <[email protected]>
> >
> > > I'll be the first to admit I'm not very familiar with this code area,
> but
> > > is it possible that this change could mean that we miss @Specializes
> > added
> > > to the AnnotatedType classes in the super class hierarchy, as you are
> > > walking up the class objects themselves looking for the annotation?
> > >
> >
>