Program: 59585
Project: 59585
Buggy source:
private void generateToManyNavProperties(List<EdmAssociation.Builder> associations,List<EdmAssociationSet.Builder> associationSets,Map<String,EdmEntityType.Builder> entityTypesByName,Map<String,EdmEntitySet.Builder> entitySetByName,Map<Class<?>,String> entityNameByClass,String entityTypeName,InMemoryEntityInfo<?,?> ei,Class<?> clazz1){
  for (  String assocProp : ei.properties.getCollectionNames()) {
    final EdmEntityType.Builder eet1=entityTypesByName.get(entityTypeName);
    Class<?> clazz2=ei.properties.getCollectionElementType(assocProp);
    String eetName2=entityNameByClass.get(clazz2);
    if (eetName2 == null)     continue;
    final EdmEntityType.Builder eet2=entityTypesByName.get(eetName2);
    try {
      EdmAssociation.Builder assoc=Enumerable.create(associations).firstOrNull(new Predicate1<EdmAssociation.Builder>(){
        public boolean apply(        EdmAssociation.Builder input){
          return input.getEnd1().getType().equals(eet2) && input.getEnd2().getType().equals(eet1);
        }
      }
);
      EdmAssociationEnd.Builder fromRole, toRole;
      if (assoc == null) {
        EdmMultiplicity m1=EdmMultiplicity.ZERO_TO_ONE;
        EdmMultiplicity m2=EdmMultiplicity.MANY;
        InMemoryEntityInfo<?,?> 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.getName(),eet2.getName());
        EdmAssociationEnd.Builder assocEnd1=EdmAssociationEnd.newBuilder().setRole(eet1.getName()).setType(eet1).setMultiplicity(m1);
        String assocEnd2Name=eet2.getName();
        if (assocEnd2Name.equals(eet1.getName()))         assocEnd2Name=assocEnd2Name + "String_Node_Str";
        EdmAssociationEnd.Builder assocEnd2=EdmAssociationEnd.newBuilder().setRole(assocEnd2Name).setType(eet2).setMultiplicity(m2);
        assoc=EdmAssociation.newBuilder().setNamespace(namespace).setName(assocName).setEnds(assocEnd1,assocEnd2);
        associations.add(assoc);
        EdmEntitySet.Builder ees1=entitySetByName.get(eet1.getName());
        EdmEntitySet.Builder ees2=entitySetByName.get(eet2.getName());
        EdmAssociationSet.Builder eas=EdmAssociationSet.newBuilder().setName(assocName).setAssociation(assoc).setEnds(EdmAssociationSetEnd.newBuilder().setRole(assocEnd1).setEntitySet(ees1),EdmAssociationSetEnd.newBuilder().setRole(assocEnd2).setEntitySet(ees2));
        associationSets.add(eas);
        fromRole=assoc.getEnd1();
        toRole=assoc.getEnd2();
      }
 else {
        fromRole=assoc.getEnd2();
        toRole=assoc.getEnd1();
      }
      EdmNavigationProperty.Builder np=EdmNavigationProperty.newBuilder(assocProp).setRelationship(assoc).setFromTo(fromRole,toRole);
      eet1.addNavigationProperties(np);
    }
 catch (    Exception e) {
      log.log(Level.WARNING,"String_Node_Str" + e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
private void generateToManyNavProperties(List<EdmAssociation.Builder> associations,List<EdmAssociationSet.Builder> associationSets,Map<String,EdmEntityType.Builder> entityTypesByName,Map<String,EdmEntitySet.Builder> entitySetByName,Map<Class<?>,String> entityNameByClass,String entityTypeName,InMemoryEntityInfo<?> ei,Class<?> clazz1){
  for (  String assocProp : ei.properties.getCollectionNames()) {
    final EdmEntityType.Builder eet1=entityTypesByName.get(entityTypeName);
    Class<?> clazz2=ei.properties.getCollectionElementType(assocProp);
    String eetName2=entityNameByClass.get(clazz2);
    if (eetName2 == null)     continue;
    final EdmEntityType.Builder eet2=entityTypesByName.get(eetName2);
    try {
      EdmAssociation.Builder assoc=Enumerable.create(associations).firstOrNull(new Predicate1<EdmAssociation.Builder>(){
        public boolean apply(        EdmAssociation.Builder input){
          return input.getEnd1().getType().equals(eet2) && input.getEnd2().getType().equals(eet1);
        }
      }
);
      EdmAssociationEnd.Builder fromRole, toRole;
      if (assoc == null) {
        EdmMultiplicity m1=EdmMultiplicity.ZERO_TO_ONE;
        EdmMultiplicity m2=EdmMultiplicity.MANY;
        InMemoryEntityInfo<?> 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.getName(),eet2.getName());
        EdmAssociationEnd.Builder assocEnd1=EdmAssociationEnd.newBuilder().setRole(eet1.getName()).setType(eet1).setMultiplicity(m1);
        String assocEnd2Name=eet2.getName();
        if (assocEnd2Name.equals(eet1.getName()))         assocEnd2Name=assocEnd2Name + "String_Node_Str";
        EdmAssociationEnd.Builder assocEnd2=EdmAssociationEnd.newBuilder().setRole(assocEnd2Name).setType(eet2).setMultiplicity(m2);
        assoc=EdmAssociation.newBuilder().setNamespace(namespace).setName(assocName).setEnds(assocEnd1,assocEnd2);
        associations.add(assoc);
        EdmEntitySet.Builder ees1=entitySetByName.get(eet1.getName());
        EdmEntitySet.Builder ees2=entitySetByName.get(eet2.getName());
        EdmAssociationSet.Builder eas=EdmAssociationSet.newBuilder().setName(assocName).setAssociation(assoc).setEnds(EdmAssociationSetEnd.newBuilder().setRole(assocEnd1).setEntitySet(ees1),EdmAssociationSetEnd.newBuilder().setRole(assocEnd2).setEntitySet(ees2));
        associationSets.add(eas);
        fromRole=assoc.getEnd1();
        toRole=assoc.getEnd2();
      }
 else {
        fromRole=assoc.getEnd2();
        toRole=assoc.getEnd1();
      }
      EdmNavigationProperty.Builder np=EdmNavigationProperty.newBuilder(assocProp).setRelationship(assoc).setFromTo(fromRole,toRole);
      eet1.addNavigationProperties(np);
    }
 catch (    Exception e) {
      log.log(Level.WARNING,"String_Node_Str" + e.getMessage(),e);
    }
  }
}