if (sortedProducerBeans.isEmpty())
{
return;
}
AlternativesManager altManager = webBeansContext.getAlternativesManager();
Method superMethod = sortedProducerBeans.get(0).getCreatorMethod();
for(int i=1; i<sortedProducerBeans.size(); i++)
{
ProducerMethodBean bean = sortedProducerBeans.get(i);
ProducerMethodBean superBean = sortedProducerBeans.get(i - 1);
// inherit superbean qualifiers
Set<Annotation> qualifiers = superBean.getQualifiers();
for(Annotation an : qualifiers)
{
bean.addQualifier(an);
}
// inherit name is super class has name
boolean isSuperHasName = configuredProducerSpecializedName(bean, bean.getCreatorMethod(), superMethod);
// disable super bean if needed
if (bean.getCreatorMethod().getAnnotation(Alternative.class) == null)
{
//disable superbean if the current bean is not an alternative
superBean.setEnabled(false);
}
else if(altManager.isClassAlternative(bean.getBeanClass()))
{
//disable superbean if the current bean is an enabled alternative
superBean.setEnabled(false);
}