Program: 59583
Project: 59583
Buggy source:
@Override public EdmDataServices.Builder generateEdm(EdmDecorator decorator){
  List<EdmSchema.Builder> schemas=new ArrayList<EdmSchema.Builder>();
  List<EdmEntityContainer.Builder> containers=new ArrayList<EdmEntityContainer.Builder>();
  List<EdmEntitySet.Builder> entitySets=new ArrayList<EdmEntitySet.Builder>();
  List<EdmEntityType.Builder> entityTypes=new ArrayList<EdmEntityType.Builder>();
  List<EdmAssociation.Builder> associations=new ArrayList<EdmAssociation.Builder>();
  List<EdmAssociationSet.Builder> associationSets=new ArrayList<EdmAssociationSet.Builder>();
  createStructuralEntities(decorator,entitySets,entityTypes);
  Map<String,EdmEntityType.Builder> entityTypesByName=Enumerable.create(entityTypes).toMap(new Func1<EdmEntityType.Builder,String>(){
    public String apply(    EdmEntityType.Builder input){
      return input.getName();
    }
  }
);
  Map<String,EdmEntitySet.Builder> entitySetByName=Enumerable.create(entitySets).toMap(new Func1<EdmEntitySet.Builder,String>(){
    public String apply(    EdmEntitySet.Builder input){
      return input.getName();
    }
  }
);
  Map<Class<?>,String> entityNameByClass=new HashMap<Class<?>,String>();
  for (  Entry<String,InMemoryEntityInfo<?,?>> e : eis.entrySet())   entityNameByClass.put(e.getValue().entityClass,e.getKey());
  createNavigationProperties(associations,associationSets,entityTypesByName,entitySetByName,entityNameByClass);
  EdmEntityContainer.Builder container=EdmEntityContainer.newBuilder().setName(CONTAINER_NAME).setIsDefault(true).addEntitySets(entitySets).addAssociationSets(associationSets);
  containers.add(container);
  EdmSchema.Builder schema=EdmSchema.newBuilder().setNamespace(namespace).addEntityTypes(entityTypes).addAssociations(associations).addEntityContainers(containers);
  if (decorator != null) {
    schema.setDocumentation(decorator.getDocumentationForSchema(namespace));
    schema.setAnnotations(decorator.getAnnotationsForSchema(namespace));
  }
  schemas.add(schema);
  EdmDataServices.Builder rt=EdmDataServices.newBuilder().addSchemas(schemas);
  if (decorator != null)   rt.addNamespaces(decorator.getNamespaces());
  return rt;
}

Fixed version (ground truth):
@Override public EdmDataServices.Builder generateEdm(EdmDecorator decorator){
  List<EdmSchema.Builder> schemas=new ArrayList<EdmSchema.Builder>();
  List<EdmEntityContainer.Builder> containers=new ArrayList<EdmEntityContainer.Builder>();
  List<EdmEntitySet.Builder> entitySets=new ArrayList<EdmEntitySet.Builder>();
  List<EdmEntityType.Builder> entityTypes=new ArrayList<EdmEntityType.Builder>();
  List<EdmAssociation.Builder> associations=new ArrayList<EdmAssociation.Builder>();
  List<EdmAssociationSet.Builder> associationSets=new ArrayList<EdmAssociationSet.Builder>();
  createStructuralEntities(decorator,entitySets,entityTypes);
  Map<String,EdmEntityType.Builder> entityTypesByName=Enumerable.create(entityTypes).toMap(new Func1<EdmEntityType.Builder,String>(){
    public String apply(    EdmEntityType.Builder input){
      return input.getName();
    }
  }
);
  Map<String,EdmEntitySet.Builder> entitySetByName=Enumerable.create(entitySets).toMap(new Func1<EdmEntitySet.Builder,String>(){
    public String apply(    EdmEntitySet.Builder input){
      return input.getName();
    }
  }
);
  Map<Class<?>,String> entityNameByClass=new HashMap<Class<?>,String>();
  for (  Entry<String,InMemoryEntityInfo<?>> e : eis.entrySet())   entityNameByClass.put(e.getValue().entityClass,e.getKey());
  createNavigationProperties(associations,associationSets,entityTypesByName,entitySetByName,entityNameByClass);
  EdmEntityContainer.Builder container=EdmEntityContainer.newBuilder().setName(CONTAINER_NAME).setIsDefault(true).addEntitySets(entitySets).addAssociationSets(associationSets);
  containers.add(container);
  EdmSchema.Builder schema=EdmSchema.newBuilder().setNamespace(namespace).addEntityTypes(entityTypes).addAssociations(associations).addEntityContainers(containers);
  if (decorator != null) {
    schema.setDocumentation(decorator.getDocumentationForSchema(namespace));
    schema.setAnnotations(decorator.getAnnotationsForSchema(namespace));
  }
  schemas.add(schema);
  EdmDataServices.Builder rt=EdmDataServices.newBuilder().addSchemas(schemas);
  if (decorator != null)   rt.addNamespaces(decorator.getNamespaces());
  return rt;
}