Program: 62621
Project: 62621
Buggy source:
private <T>void registerSingletonBean(BeanDefinition<T> beanDefinition,Class<T> beanType,T createdBean,Qualifier<T> qualifier,boolean singleCandidate){
  if (qualifier == null) {
    if (beanDefinition instanceof BeanDefinitionDelegate) {
      String name=((BeanDefinitionDelegate<?>)beanDefinition).get(Named.class.getName(),String.class,null);
      if (name != null) {
        qualifier=Qualifiers.byName(name);
      }
    }
    if (qualifier == null) {
      Optional<String> optional=beanDefinition.getValue(javax.inject.Named.class,String.class);
      qualifier=(Qualifier<T>)optional.map(name -> Qualifiers.byAnnotation(beanDefinition,name)).orElse(null);
    }
  }
  if (LOG.isDebugEnabled()) {
    if (qualifier != null) {
      LOG.debug("String_Node_Str",qualifier,beanType.getName(),createdBean);
    }
 else {
      LOG.debug("String_Node_Str",beanType.getName(),createdBean);
    }
  }
  BeanKey key=new BeanKey<>(beanType,qualifier);
  BeanRegistration<T> registration=new BeanRegistration<>(key,beanDefinition,createdBean);
  if (singleCandidate) {
    singletonObjects.put(key,registration);
  }
  Class<?> createdType=createdBean.getClass();
  BeanKey createdBeanKey=new BeanKey(createdType,qualifier);
  Optional<Class<? extends Annotation>> qualifierAnn=beanDefinition.getAnnotationTypeByStereotype(javax.inject.Qualifier.class);
  if (qualifierAnn.isPresent()) {
    Class annotation=qualifierAnn.get();
    if (Primary.class == annotation) {
      BeanKey primaryBeanKey=new BeanKey<>(beanType,null);
      singletonObjects.put(primaryBeanKey,registration);
    }
 else {
      BeanKey qualifierKey=new BeanKey(createdType,Qualifiers.byAnnotation(beanDefinition,annotation.getName()));
      if (!qualifierKey.equals(createdBeanKey)) {
        singletonObjects.put(qualifierKey,registration);
      }
    }
  }
 else {
    if (!beanDefinition.isIterable()) {
      BeanKey primaryBeanKey=new BeanKey<>(createdType,null);
      singletonObjects.put(primaryBeanKey,registration);
    }
  }
  singletonObjects.put(createdBeanKey,registration);
}

Fixed version (ground truth):
private <T>void registerSingletonBean(BeanDefinition<T> beanDefinition,Class<T> beanType,T createdBean,Qualifier<T> qualifier,boolean singleCandidate){
  if (qualifier == null) {
    if (beanDefinition instanceof BeanDefinitionDelegate) {
      String name=((BeanDefinitionDelegate<?>)beanDefinition).get(Named.class.getName(),String.class,null);
      if (name != null) {
        qualifier=Qualifiers.byName(name);
      }
    }
    if (qualifier == null) {
      Optional<String> optional=beanDefinition.getValue(javax.inject.Named.class,String.class);
      qualifier=(Qualifier<T>)optional.map(name -> Qualifiers.byAnnotation(beanDefinition,name)).orElse(null);
    }
  }
  if (LOG.isDebugEnabled()) {
    if (qualifier != null) {
      LOG.debug("String_Node_Str",qualifier,beanType.getName(),createdBean);
    }
 else {
      LOG.debug("String_Node_Str",beanType.getName(),createdBean);
    }
  }
  BeanKey key=new BeanKey<>(beanType,qualifier);
  BeanRegistration<T> registration=new BeanRegistration<>(key,beanDefinition,createdBean);
  if (singleCandidate) {
    singletonObjects.put(key,registration);
  }
  Class<?> createdType=createdBean.getClass();
  boolean createdTypeDiffers=!createdType.equals(beanType);
  BeanKey createdBeanKey=new BeanKey(createdType,qualifier);
  Optional<Class<? extends Annotation>> qualifierAnn=beanDefinition.getAnnotationTypeByStereotype(javax.inject.Qualifier.class);
  if (qualifierAnn.isPresent()) {
    Class annotation=qualifierAnn.get();
    if (Primary.class == annotation) {
      BeanKey primaryBeanKey=new BeanKey<>(beanType,null);
      singletonObjects.put(primaryBeanKey,registration);
      if (createdTypeDiffers) {
        singletonObjects.put(new BeanKey<>(createdType,null),registration);
      }
    }
 else {
      BeanKey qualifierKey=new BeanKey<>(createdType,Qualifiers.byAnnotation(beanDefinition,annotation.getName()));
      if (!qualifierKey.equals(createdBeanKey)) {
        singletonObjects.put(qualifierKey,registration);
      }
    }
  }
 else {
    if (!beanDefinition.isIterable()) {
      BeanKey primaryBeanKey=new BeanKey<>(createdType,null);
      singletonObjects.put(primaryBeanKey,registration);
    }
 else {
      if (beanDefinition.isPrimary()) {
        BeanKey primaryBeanKey=new BeanKey<>(beanType,null);
        singletonObjects.put(primaryBeanKey,registration);
        if (createdTypeDiffers) {
          singletonObjects.put(new BeanKey<>(createdType,null),registration);
        }
      }
    }
  }
  singletonObjects.put(createdBeanKey,registration);
}