do
{
Class<? super C> superclass = annotatedToSpecialize.getJavaClass().getSuperclass();
if (superclass.equals(Object.class))
{
throw new DefinitionException("@Specialized Class : " + getAnnotated().getJavaClass().getName()
+ " must not directly extend Object.class");
}
annotatedToSpecialize = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(superclass);
} while(annotatedToSpecialize.getAnnotation(Specializes.class) != null);
defineName(annotatedToSpecialize, WebBeansUtil.getManagedBeanDefaultName(annotatedToSpecialize.getJavaClass().getSimpleName()));
}
if (name == null)
{
defineName(getAnnotated(), WebBeansUtil.getManagedBeanDefaultName(getAnnotated().getJavaClass().getSimpleName()));
}
else
{
// TODO XXX We have to check stereotypes here, too
if (getAnnotated().getJavaClass().isAnnotationPresent(Named.class))
{
throw new DefinitionException("@Specialized Class : " + getAnnotated().getJavaClass().getName()
+ " may not explicitly declare a bean name");
}
}
}