Program: 59613
Project: 59613
Buggy source:
private void generateToManyNavProperties(List<EdmAssociation> associations,List<EdmAssociationSet> associationSets,Map<String,EdmEntityType> entityTypesByName,Map<String,EdmEntitySet> entitySetByName,Map<Class<?>,String> entityNameByClass,String entitySetName,EntityInfo<?,?> ei,Class<?> clazz1){
  for (  String assocProp : ei.properties.getCollectionNames()) {
    final EdmEntityType eet1=entityTypesByName.get(entitySetName);
    Class<?> clazz2=ei.properties.getCollectionElementType(assocProp);
    String eetName2=entityNameByClass.get(clazz2);
    final EdmEntityType eet2=entityTypesByName.get(eetName2);
    try {
      EdmAssociation assoc=Enumerable.create(associations).firstOrNull(new Predicate1<EdmAssociation>(){
        public boolean apply(        EdmAssociation input){
          return input.end1.type.equals(eet2) && input.end2.type.equals(eet1);
        }
      }
);
      EdmAssociationEnd fromRole, toRole;
      if (assoc == null) {
        EdmMultiplicity m1=EdmMultiplicity.ZERO_TO_ONE;
        EdmMultiplicity m2=EdmMultiplicity.MANY;
        EntityInfo<?,?> class2eiInfo=eis.get(eetName2);
        for (        String tmp : class2eiInfo.properties.getCollectionNames()) {
          if (clazz1 == class2eiInfo.properties.getCollectionElementType(tmp)) {
            m1=EdmMultiplicity.MANY;
            m2=EdmMultiplicity.MANY;
            break;
          }
        }
        String assocName=String.format("String_Node_Str",eet1.name,eet2.name);
        EdmAssociationEnd assocEnd1=new EdmAssociationEnd(eet1.name,eet1,m1);
        String assocEnd2Name=eet2.name;
        if (assocEnd2Name.equals(eet1.name))         assocEnd2Name=assocEnd2Name + "String_Node_Str";
        EdmAssociationEnd assocEnd2=new EdmAssociationEnd(assocEnd2Name,eet2,m2);
        assoc=new EdmAssociation(namespace,null,assocName,assocEnd1,assocEnd2);
        associations.add(assoc);
        EdmEntitySet ees1=entitySetByName.get(eet1.name);
        EdmEntitySet ees2=entitySetByName.get(eet2.name);
        EdmAssociationSet eas=new EdmAssociationSet(assocName,assoc,new EdmAssociationSetEnd(assocEnd1,ees1),new EdmAssociationSetEnd(assocEnd2,ees2));
        associationSets.add(eas);
        fromRole=assoc.end1;
        toRole=assoc.end2;
      }
 else {
        fromRole=assoc.end2;
        toRole=assoc.end1;
      }
      EdmNavigationProperty np=new EdmNavigationProperty(assocProp,assoc,fromRole,toRole);
      eet1.addNavigationProperty(np);
    }
 catch (    Exception e) {
      log.log(Level.WARNING,"String_Node_Str" + e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
private void generateToManyNavProperties(List<EdmAssociation> associations,List<EdmAssociationSet> associationSets,Map<String,EdmEntityType> entityTypesByName,Map<String,EdmEntitySet> entitySetByName,Map<Class<?>,String> entityNameByClass,String entitySetName,EntityInfo<?,?> ei,Class<?> clazz1){
  for (  String assocProp : ei.properties.getCollectionNames()) {
    final EdmEntityType eet1=entityTypesByName.get(entitySetName);
    Class<?> clazz2=ei.properties.getCollectionElementType(assocProp);
    String eetName2=entityNameByClass.get(clazz2);
    if (eetName2 == null)     continue;
    final EdmEntityType eet2=entityTypesByName.get(eetName2);
    try {
      EdmAssociation assoc=Enumerable.create(associations).firstOrNull(new Predicate1<EdmAssociation>(){
        public boolean apply(        EdmAssociation input){
          return input.end1.type.equals(eet2) && input.end2.type.equals(eet1);
        }
      }
);
      EdmAssociationEnd fromRole, toRole;
      if (assoc == null) {
        EdmMultiplicity m1=EdmMultiplicity.ZERO_TO_ONE;
        EdmMultiplicity m2=EdmMultiplicity.MANY;
        EntityInfo<?,?> class2eiInfo=eis.get(eetName2);
        for (        String tmp : class2eiInfo.properties.getCollectionNames()) {
          if (clazz1 == class2eiInfo.properties.getCollectionElementType(tmp)) {
            m1=EdmMultiplicity.MANY;
            m2=EdmMultiplicity.MANY;
            break;
          }
        }
        String assocName=String.format("String_Node_Str",eet1.name,eet2.name);
        EdmAssociationEnd assocEnd1=new EdmAssociationEnd(eet1.name,eet1,m1);
        String assocEnd2Name=eet2.name;
        if (assocEnd2Name.equals(eet1.name))         assocEnd2Name=assocEnd2Name + "String_Node_Str";
        EdmAssociationEnd assocEnd2=new EdmAssociationEnd(assocEnd2Name,eet2,m2);
        assoc=new EdmAssociation(namespace,null,assocName,assocEnd1,assocEnd2);
        associations.add(assoc);
        EdmEntitySet ees1=entitySetByName.get(eet1.name);
        EdmEntitySet ees2=entitySetByName.get(eet2.name);
        EdmAssociationSet eas=new EdmAssociationSet(assocName,assoc,new EdmAssociationSetEnd(assocEnd1,ees1),new EdmAssociationSetEnd(assocEnd2,ees2));
        associationSets.add(eas);
        fromRole=assoc.end1;
        toRole=assoc.end2;
      }
 else {
        fromRole=assoc.end2;
        toRole=assoc.end1;
      }
      EdmNavigationProperty np=new EdmNavigationProperty(assocProp,assoc,fromRole,toRole);
      eet1.addNavigationProperty(np);
    }
 catch (    Exception e) {
      log.log(Level.WARNING,"String_Node_Str" + e.getMessage(),e);
    }
  }
}