Program: 190664
Project: 190664
Buggy source:
public CElement complexType(XSComplexType type){
  CElement ci=allow(type,type.getName());
  if (ci != null)   return ci;
  BindInfo bi=builder.getBindInfo(type);
  if (type.isGlobal()) {
    QName tagName=null;
    String className=deriveName(type);
    if (getGlobalBinding().isSimpleMode()) {
      XSElementDecl referer=getSoleElementReferer(type);
      if (referer != null && isCollapsable(referer)) {
        tagName=getName(referer);
        className=deriveName(referer);
      }
    }
    JPackage pkg=selector.getPackage(type.getTargetNamespace());
    return new CClassInfo(model,pkg,className,type.getLocator(),getTypeName(type),tagName,type,bi.toCustomizationList());
  }
 else {
    XSElementDecl element=type.getScope();
    if (element.isGlobal() && isCollapsable(element)) {
      if (builder.getBindInfo(element).get(BIClass.class) != null)       return null;
      return new CClassInfo(model,selector.getClassScope(),deriveName(element),element.getLocator(),null,getName(element),element,bi.toCustomizationList());
    }
    CElement parentType=selector.isBound(element,type);
    String className;
    CClassInfoParent scope;
    if (parentType != null && parentType instanceof CElementInfo && ((CElementInfo)parentType).hasClass()) {
      scope=(CElementInfo)parentType;
      className="String_Node_Str";
    }
 else {
      className=builder.getNameConverter().toClassName(element.getName());
      BISchemaBinding sb=builder.getBindInfo(type.getOwnerSchema()).get(BISchemaBinding.class);
      if (sb != null)       className=sb.mangleAnonymousTypeClassName(className);
      scope=selector.getClassScope();
    }
    return new CClassInfo(model,scope,className,type.getLocator(),null,null,type,bi.toCustomizationList());
  }
}

Fixed version (ground truth):
public CElement complexType(XSComplexType type){
  CElement ci=allow(type,type.getName());
  if (ci != null)   return ci;
  BindInfo bi=builder.getBindInfo(type);
  if (type.isGlobal()) {
    QName tagName=null;
    String className=deriveName(type);
    Locator loc=type.getLocator();
    if (getGlobalBinding().isSimpleMode()) {
      XSElementDecl referer=getSoleElementReferer(type);
      if (referer != null && isCollapsable(referer)) {
        tagName=getName(referer);
        className=deriveName(referer);
        loc=referer.getLocator();
      }
    }
    JPackage pkg=selector.getPackage(type.getTargetNamespace());
    return new CClassInfo(model,pkg,className,loc,getTypeName(type),tagName,type,bi.toCustomizationList());
  }
 else {
    XSElementDecl element=type.getScope();
    if (element.isGlobal() && isCollapsable(element)) {
      if (builder.getBindInfo(element).get(BIClass.class) != null)       return null;
      return new CClassInfo(model,selector.getClassScope(),deriveName(element),element.getLocator(),null,getName(element),element,bi.toCustomizationList());
    }
    CElement parentType=selector.isBound(element,type);
    String className;
    CClassInfoParent scope;
    if (parentType != null && parentType instanceof CElementInfo && ((CElementInfo)parentType).hasClass()) {
      scope=(CElementInfo)parentType;
      className="String_Node_Str";
    }
 else {
      className=builder.getNameConverter().toClassName(element.getName());
      BISchemaBinding sb=builder.getBindInfo(type.getOwnerSchema()).get(BISchemaBinding.class);
      if (sb != null)       className=sb.mangleAnonymousTypeClassName(className);
      scope=selector.getClassScope();
    }
    return new CClassInfo(model,scope,className,type.getLocator(),null,null,type,bi.toCustomizationList());
  }
}