Program: 18087
Project: 18087
Buggy source:
@Override public void build() throws ODataJPAModelException {
  JPAEdmBuilder keyViewBuilder=null;
  properties=new ArrayList<Property>();
  Set<?> jpaAttributes=null;
  if (isBuildModeComplexType) {
    jpaAttributes=complexTypeView.getJPAEmbeddableType().getAttributes();
  }
 else {
    jpaAttributes=entityTypeView.getJPAEntityType().getAttributes();
  }
  for (  Object jpaAttribute : jpaAttributes) {
    currentAttribute=(Attribute<?,?>)jpaAttribute;
    PersistentAttributeType attributeType=currentAttribute.getPersistentAttributeType();
switch (attributeType) {
case BASIC:
      currentSimpleProperty=new SimpleProperty();
    JPAEdmNameBuilder.build((JPAEdmPropertyView)JPAEdmProperty.this);
  EdmSimpleTypeKind simpleTypeKind=JPATypeConvertor.convertToEdmSimpleType(currentAttribute.getJavaType());
currentSimpleProperty.setType(simpleTypeKind);
currentSimpleProperty.setFacets(setFacets(currentAttribute));
properties.add(currentSimpleProperty);
if (((SingularAttribute<?,?>)currentAttribute).isId()) {
if (keyView == null) {
keyView=new JPAEdmKey(JPAEdmProperty.this);
keyViewBuilder=keyView.getBuilder();
}
keyViewBuilder.build();
}
break;
case EMBEDDED:
ComplexType complexType=complexTypeView.searchComplexType(currentAttribute.getJavaType().getName());
if (complexType == null) {
JPAEdmComplexTypeView complexTypeViewLocal=new JPAEdmComplexType(schemaView);
complexTypeViewLocal.getBuilder().build();
complexType=complexTypeViewLocal.getEdmComplexType();
complexTypeView.addCompleTypeView(complexTypeViewLocal);
}
if (isBuildModeComplexType == false && entityTypeView.getJPAEntityType().getIdType().getJavaType().equals(currentAttribute.getJavaType())) {
if (keyView == null) keyView=new JPAEdmKey(complexTypeView,JPAEdmProperty.this);
keyView.getBuilder().build();
}
 else {
currentComplexProperty=new ComplexProperty();
JPAEdmNameBuilder.build((JPAEdmComplexPropertyView)JPAEdmProperty.this,JPAEdmProperty.this);
currentComplexProperty.setType(new FullQualifiedName(schemaView.getEdmSchema().getNamespace(),complexType.getName()));
currentComplexProperty.setFacets(setFacets(currentAttribute));
properties.add(currentComplexProperty);
}
break;
case MANY_TO_MANY:
case ONE_TO_MANY:
case ONE_TO_ONE:
case MANY_TO_ONE:
JPAEdmAssociationEndView associationEndView=new JPAEdmAssociationEnd(entityTypeView,JPAEdmProperty.this);
associationEndView.getBuilder().build();
JPAEdmAssociationView associationView=schemaView.getJPAEdmAssociationView();
if (associationView.searchAssociation(associationEndView) == null) {
JPAEdmAssociationView associationViewLocal=new JPAEdmAssociation(associationEndView);
associationViewLocal.getBuilder().build();
associationView.addJPAEdmAssociationView(associationViewLocal);
}
if (false) {
JPAEdmReferentialContraintView refView=new JPAEdmReferentialConstraint(associationView,JPAEdmProperty.this);
refView.getBuilder().build();
associationView.addJPAEdmRefConstraintView(refView);
}
break;
default :
break;
}
}
}

Fixed version (ground truth):
@Override public void build() throws ODataJPAModelException {
  JPAEdmBuilder keyViewBuilder=null;
  properties=new ArrayList<Property>();
  Set<?> jpaAttributes=null;
  if (isBuildModeComplexType) {
    jpaAttributes=complexTypeView.getJPAEmbeddableType().getAttributes();
  }
 else {
    jpaAttributes=entityTypeView.getJPAEntityType().getAttributes();
  }
  for (  Object jpaAttribute : jpaAttributes) {
    currentAttribute=(Attribute<?,?>)jpaAttribute;
    PersistentAttributeType attributeType=currentAttribute.getPersistentAttributeType();
switch (attributeType) {
case BASIC:
      currentSimpleProperty=new SimpleProperty();
    JPAEdmNameBuilder.build((JPAEdmPropertyView)JPAEdmProperty.this);
  EdmSimpleTypeKind simpleTypeKind=JPATypeConvertor.convertToEdmSimpleType(currentAttribute.getJavaType());
currentSimpleProperty.setType(simpleTypeKind);
currentSimpleProperty.setFacets(setFacets(currentAttribute));
properties.add(currentSimpleProperty);
if (((SingularAttribute<?,?>)currentAttribute).isId()) {
if (keyView == null) {
keyView=new JPAEdmKey(JPAEdmProperty.this);
keyViewBuilder=keyView.getBuilder();
}
keyViewBuilder.build();
}
break;
case EMBEDDED:
ComplexType complexType=complexTypeView.searchComplexType(currentAttribute.getJavaType().getName());
if (complexType == null) {
JPAEdmComplexTypeView complexTypeViewLocal=new JPAEdmComplexType(schemaView);
complexTypeViewLocal.getBuilder().build();
complexType=complexTypeViewLocal.getEdmComplexType();
complexTypeView.addCompleTypeView(complexTypeViewLocal);
}
if (isBuildModeComplexType == false && entityTypeView.getJPAEntityType().getIdType().getJavaType().equals(currentAttribute.getJavaType())) {
if (keyView == null) keyView=new JPAEdmKey(complexTypeView,JPAEdmProperty.this);
keyView.getBuilder().build();
}
 else {
currentComplexProperty=new ComplexProperty();
JPAEdmNameBuilder.build((JPAEdmComplexPropertyView)JPAEdmProperty.this,JPAEdmProperty.this);
currentComplexProperty.setType(new FullQualifiedName(schemaView.getEdmSchema().getNamespace(),complexType.getName()));
currentComplexProperty.setFacets(setFacets(currentAttribute));
properties.add(currentComplexProperty);
}
break;
case MANY_TO_MANY:
case ONE_TO_MANY:
case ONE_TO_ONE:
case MANY_TO_ONE:
JPAEdmAssociationEndView associationEndView=new JPAEdmAssociationEnd(entityTypeView,JPAEdmProperty.this);
associationEndView.getBuilder().build();
JPAEdmAssociationView associationView=schemaView.getJPAEdmAssociationView();
if (associationView.searchAssociation(associationEndView) == null) {
JPAEdmAssociationView associationViewLocal=new JPAEdmAssociation(associationEndView);
associationViewLocal.getBuilder().build();
associationView.addJPAEdmAssociationView(associationViewLocal);
}
JPAEdmReferentialContraintView refView=new JPAEdmReferentialConstraint(associationView,JPAEdmProperty.this);
if (navigationPropertyView == null) {
navigationPropertyView=new JPAEdmNavigationProperty(schemaView);
}
JPAEdmNavigationPropertyView localNavigationPropertyView=new JPAEdmNavigationProperty(schemaView,associationView,JPAEdmProperty.this);
localNavigationPropertyView.getBuilder().build();
navigationPropertyView.addJPAEdmNavigationPropertyView(localNavigationPropertyView);
break;
default :
break;
}
}
}