Program: 190681
Project: 190681
Buggy source:
/** 
 * @param typeRefs used to build  {@link Bridge}s. Can be empty.
 * @param c14nSupport {@link #c14nSupport}.
 */
public JAXBContextImpl(Class[] classes,Collection<TypeReference> typeRefs,Map<Class,Class> subclassReplacements,String defaultNsUri,boolean c14nSupport,@Nullable RuntimeAnnotationReader ar) throws JAXBException {
  DatatypeConverter.setDatatypeConverter(DatatypeConverterImpl.theInstance);
  if (defaultNsUri == null)   defaultNsUri="String_Node_Str";
  if (ar == null)   ar=new RuntimeInlineAnnotationReader();
  if (subclassReplacements == null)   subclassReplacements=Collections.emptyMap();
  if (typeRefs == null)   typeRefs=Collections.emptyList();
  this.annotaitonReader=ar;
  this.subclassReplacements=subclassReplacements;
  this.defaultNsUri=defaultNsUri;
  this.c14nSupport=c14nSupport;
  this.classes=new Class[classes.length];
  System.arraycopy(classes,0,this.classes,0,classes.length);
  RuntimeTypeInfoSet typeSet=getTypeInfoSet();
  elements.put(null,new LinkedHashMap<QName,ElementBeanInfoImpl>());
  for (  RuntimeBuiltinLeafInfo leaf : RuntimeBuiltinLeafInfoImpl.builtinBeanInfos) {
    LeafBeanInfoImpl<?> bi=new LeafBeanInfoImpl(this,leaf);
    beanInfoMap.put(leaf.getClazz(),bi);
    for (    QName t : bi.getTypeNames())     typeMap.put(t,bi);
  }
  for (  RuntimeEnumLeafInfo e : typeSet.enums().values()) {
    JaxBeanInfo<?> bi=getOrCreate(e);
    for (    QName qn : bi.getTypeNames())     typeMap.put(qn,bi);
    if (e.isElement())     rootMap.put(e.getElementName(),bi);
  }
  for (  RuntimeArrayInfo a : typeSet.arrays().values()) {
    JaxBeanInfo<?> ai=getOrCreate(a);
    for (    QName qn : ai.getTypeNames())     typeMap.put(qn,ai);
  }
  for (  RuntimeClassInfo ci : typeSet.beans().values()) {
    ClassBeanInfoImpl<?> bi=getOrCreate(ci);
    if (bi.isElement())     rootMap.put(ci.getElementName(),bi);
    for (    QName qn : bi.getTypeNames())     typeMap.put(qn,bi);
  }
  for (  RuntimeElementInfo n : typeSet.getAllElements()) {
    ElementBeanInfoImpl bi=getOrCreate(n);
    if (n.getScope() == null)     rootMap.put(n.getElementName(),bi);
    RuntimeClassInfo scope=n.getScope();
    Class scopeClazz=scope == null ? null : scope.getClazz();
    Map<QName,ElementBeanInfoImpl> m=elements.get(scopeClazz);
    if (m == null) {
      m=new LinkedHashMap<QName,ElementBeanInfoImpl>();
      elements.put(scopeClazz,m);
    }
    m.put(n.getElementName(),bi);
  }
  beanInfoMap.put(JAXBElement.class,new ElementBeanInfoImpl(this));
  beanInfoMap.put(CompositeStructure.class,new CompositeStructureBeanInfo(this));
  getOrCreate(typeSet.getAnyTypeInfo());
  for (  JaxBeanInfo bi : beanInfos.values())   bi.link(this);
  for (  Map.Entry<Class,Class> e : RuntimeUtil.primitiveToBox.entrySet())   beanInfoMap.put(e.getKey(),beanInfoMap.get(e.getValue()));
  ReflectionNavigator nav=typeSet.getNavigator();
  for (  TypeReference tr : typeRefs) {
    XmlJavaTypeAdapter xjta=tr.get(XmlJavaTypeAdapter.class);
    Adapter<Type,Class> a=null;
    XmlList xl=tr.get(XmlList.class);
    Class erasedType=nav.erasure(tr.type);
    if (xjta != null) {
      a=new Adapter<Type,Class>(xjta.value(),nav);
    }
    if (tr.get(XmlAttachmentRef.class) != null) {
      a=new Adapter<Type,Class>(SwaRefAdapter.class,nav);
    }
    if (a != null) {
      erasedType=nav.erasure(a.defaultType);
    }
    Name name=nameBuilder.createElementName(tr.tagName);
    InternalBridge bridge;
    if (xl == null)     bridge=new BridgeImpl(this,name,getBeanInfo(erasedType,true),tr);
 else     bridge=new BridgeImpl(this,name,new ValueListBeanInfoImpl(this,erasedType),tr);
    if (a != null)     bridge=new BridgeAdapter(bridge,a.adapterType);
    bridges.put(tr,bridge);
  }
  this.nameList=nameBuilder.conclude();
  for (  JaxBeanInfo bi : beanInfos.values())   bi.wrapUp();
  nameBuilder=null;
  beanInfos=null;
}

Fixed version (ground truth):
/** 
 * @param typeRefs used to build  {@link Bridge}s. Can be empty.
 * @param c14nSupport {@link #c14nSupport}.
 */
public JAXBContextImpl(Class[] classes,Collection<TypeReference> typeRefs,Map<Class,Class> subclassReplacements,String defaultNsUri,boolean c14nSupport,@Nullable RuntimeAnnotationReader ar) throws JAXBException {
  DatatypeConverter.setDatatypeConverter(DatatypeConverterImpl.theInstance);
  if (defaultNsUri == null)   defaultNsUri="String_Node_Str";
  if (ar == null)   ar=new RuntimeInlineAnnotationReader();
  if (subclassReplacements == null)   subclassReplacements=Collections.emptyMap();
  if (typeRefs == null)   typeRefs=Collections.emptyList();
  this.annotaitonReader=ar;
  this.subclassReplacements=subclassReplacements;
  this.defaultNsUri=defaultNsUri;
  this.c14nSupport=c14nSupport;
  this.classes=new Class[classes.length];
  System.arraycopy(classes,0,this.classes,0,classes.length);
  RuntimeTypeInfoSet typeSet=getTypeInfoSet();
  elements.put(null,new LinkedHashMap<QName,ElementBeanInfoImpl>());
  for (  RuntimeBuiltinLeafInfo leaf : RuntimeBuiltinLeafInfoImpl.builtinBeanInfos) {
    LeafBeanInfoImpl<?> bi=new LeafBeanInfoImpl(this,leaf);
    beanInfoMap.put(leaf.getClazz(),bi);
    for (    QName t : bi.getTypeNames())     typeMap.put(t,bi);
  }
  for (  RuntimeEnumLeafInfo e : typeSet.enums().values()) {
    JaxBeanInfo<?> bi=getOrCreate(e);
    for (    QName qn : bi.getTypeNames())     typeMap.put(qn,bi);
    if (e.isElement())     rootMap.put(e.getElementName(),bi);
  }
  for (  RuntimeArrayInfo a : typeSet.arrays().values()) {
    JaxBeanInfo<?> ai=getOrCreate(a);
    for (    QName qn : ai.getTypeNames())     typeMap.put(qn,ai);
  }
  for (  RuntimeClassInfo ci : typeSet.beans().values()) {
    ClassBeanInfoImpl<?> bi=getOrCreate(ci);
    if (bi.isElement())     rootMap.put(ci.getElementName(),bi);
    for (    QName qn : bi.getTypeNames())     typeMap.put(qn,bi);
  }
  for (  RuntimeElementInfo n : typeSet.getAllElements()) {
    ElementBeanInfoImpl bi=getOrCreate(n);
    if (n.getScope() == null)     rootMap.put(n.getElementName(),bi);
    RuntimeClassInfo scope=n.getScope();
    Class scopeClazz=scope == null ? null : scope.getClazz();
    Map<QName,ElementBeanInfoImpl> m=elements.get(scopeClazz);
    if (m == null) {
      m=new LinkedHashMap<QName,ElementBeanInfoImpl>();
      elements.put(scopeClazz,m);
    }
    m.put(n.getElementName(),bi);
  }
  beanInfoMap.put(JAXBElement.class,new ElementBeanInfoImpl(this));
  beanInfoMap.put(CompositeStructure.class,new CompositeStructureBeanInfo(this));
  getOrCreate(typeSet.getAnyTypeInfo());
  for (  JaxBeanInfo bi : beanInfos.values())   bi.link(this);
  for (  Map.Entry<Class,Class> e : RuntimeUtil.primitiveToBox.entrySet())   beanInfoMap.put(e.getKey(),beanInfoMap.get(e.getValue()));
  ReflectionNavigator nav=typeSet.getNavigator();
  for (  TypeReference tr : typeRefs) {
    XmlJavaTypeAdapter xjta=tr.get(XmlJavaTypeAdapter.class);
    Adapter<Type,Class> a=null;
    XmlList xl=tr.get(XmlList.class);
    Class erasedType=nav.erasure(tr.type);
    if (xjta != null) {
      a=new Adapter<Type,Class>(xjta.value(),nav);
    }
    if (tr.get(XmlAttachmentRef.class) != null) {
      a=new Adapter<Type,Class>(SwaRefAdapter.class,nav);
      hasSwaRef=true;
    }
    if (a != null) {
      erasedType=nav.erasure(a.defaultType);
    }
    Name name=nameBuilder.createElementName(tr.tagName);
    InternalBridge bridge;
    if (xl == null)     bridge=new BridgeImpl(this,name,getBeanInfo(erasedType,true),tr);
 else     bridge=new BridgeImpl(this,name,new ValueListBeanInfoImpl(this,erasedType),tr);
    if (a != null)     bridge=new BridgeAdapter(bridge,a.adapterType);
    bridges.put(tr,bridge);
  }
  this.nameList=nameBuilder.conclude();
  for (  JaxBeanInfo bi : beanInfos.values())   bi.wrapUp();
  nameBuilder=null;
  beanInfos=null;
}