Program: 146027
Project: 146027
Buggy source:
@Override public void validate(ValidationHandler handler){
  if (!superTypes.isEmpty()) {
    List<TypeMetadata> thisSuperTypes=new LinkedList<TypeMetadata>(superTypes);
    for (    TypeMetadata superType : thisSuperTypes) {
      if (isInstantiable() == superType.isInstantiable()) {
        if (superType instanceof ComplexTypeMetadata) {
          Collection<FieldMetadata> thisTypeKeyFields=getKeyFields();
          for (          FieldMetadata thisTypeKeyField : thisTypeKeyFields) {
            if (!((ComplexTypeMetadata)superType).hasField(thisTypeKeyField.getName())) {
              handler.error(superType,"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str"+ superType.getName()+ "String_Node_Str",superType.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),superType.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.TYPE_CANNOT_OVERRIDE_SUPER_TYPE_KEY);
            }
          }
        }
      }
    }
  }
  for (  FieldMetadata value : fieldMetadata.values()) {
    value.validate(handler);
  }
  for (  FieldMetadata keyField : keyFields.values()) {
    if (keyField.isMany()) {
      handler.error(keyField,"String_Node_Str",keyField.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),keyField.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.FIELD_KEY_CANNOT_BE_REPEATABLE);
    }
  }
  for (  FieldMetadata pkInfo : primaryKeyInfo) {
    if (!this.equals(pkInfo.getContainingType())) {
      handler.error(pkInfo,"String_Node_Str",pkInfo.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),pkInfo.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.PRIMARY_KEY_INFO_NOT_IN_ENTITY);
      continue;
    }
    int previousErrorCount=handler.getErrorCount();
    pkInfo.validate(handler);
    if (handler.getErrorCount() == previousErrorCount) {
      if (pkInfo.isMany()) {
        handler.error(pkInfo,"String_Node_Str",pkInfo.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),pkInfo.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.PRIMARY_KEY_INFO_CANNOT_BE_REPEATABLE);
        continue;
      }
      if (!isPrimitiveTypeField(pkInfo)) {
        handler.warning(pkInfo,"String_Node_Str",pkInfo.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),pkInfo.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.PRIMARY_KEY_INFO_TYPE_NOT_PRIMITIVE);
      }
    }
  }
  for (  FieldMetadata lookupField : lookupFields) {
    int errorCount=handler.getErrorCount();
    lookupField.validate(handler);
    if (handler.getErrorCount() > errorCount) {
      continue;
    }
    if (!this.equals(lookupField.getContainingType())) {
      handler.error(lookupField,"String_Node_Str",lookupField.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),lookupField.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.LOOKUP_FIELD_NOT_IN_ENTITY);
      continue;
    }
    if (lookupField.isKey()) {
      handler.error(lookupField,"String_Node_Str",lookupField.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),lookupField.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.LOOKUP_FIELD_CANNOT_BE_KEY);
      continue;
    }
    lookupField.validate(handler);
    if (!isPrimitiveTypeField(lookupField)) {
      handler.error(lookupField,"String_Node_Str",lookupField.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),lookupField.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.LOOKUP_FIELD_MUST_BE_SIMPLE_TYPE);
    }
  }
}

Fixed version (ground truth):
@Override public void validate(ValidationHandler handler){
  if (!superTypes.isEmpty()) {
    List<TypeMetadata> thisSuperTypes=new LinkedList<TypeMetadata>(superTypes);
    for (    TypeMetadata superType : thisSuperTypes) {
      if (isInstantiable() == superType.isInstantiable()) {
        if (superType instanceof ComplexTypeMetadata) {
          Collection<FieldMetadata> thisTypeKeyFields=getKeyFields();
          for (          FieldMetadata thisTypeKeyField : thisTypeKeyFields) {
            if (!((ComplexTypeMetadata)superType).hasField(thisTypeKeyField.getName())) {
              handler.error(superType,"String_Node_Str" + name + "String_Node_Str"+ "String_Node_Str"+ superType.getName()+ "String_Node_Str",superType.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),superType.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),superType.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.TYPE_CANNOT_OVERRIDE_SUPER_TYPE_KEY);
            }
          }
        }
      }
    }
  }
  for (  FieldMetadata value : fieldMetadata.values()) {
    value.validate(handler);
  }
  for (  FieldMetadata keyField : keyFields.values()) {
    if (keyField.isMany()) {
      handler.error(keyField,"String_Node_Str",keyField.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),keyField.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),keyField.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.FIELD_KEY_CANNOT_BE_REPEATABLE);
    }
  }
  for (  FieldMetadata pkInfo : primaryKeyInfo) {
    if (!this.equals(pkInfo.getContainingType())) {
      handler.error(this,"String_Node_Str",pkInfo.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),pkInfo.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),pkInfo.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.PRIMARY_KEY_INFO_NOT_IN_ENTITY);
      continue;
    }
    int previousErrorCount=handler.getErrorCount();
    pkInfo.validate(handler);
    if (handler.getErrorCount() == previousErrorCount) {
      if (pkInfo.isMany()) {
        handler.error(this,"String_Node_Str",pkInfo.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),pkInfo.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),pkInfo.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.PRIMARY_KEY_INFO_CANNOT_BE_REPEATABLE);
        continue;
      }
      if (!isPrimitiveTypeField(pkInfo)) {
        handler.warning(this,"String_Node_Str",pkInfo.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),pkInfo.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),pkInfo.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.PRIMARY_KEY_INFO_TYPE_NOT_PRIMITIVE);
      }
    }
  }
  for (  FieldMetadata lookupField : lookupFields) {
    int errorCount=handler.getErrorCount();
    lookupField.validate(handler);
    if (handler.getErrorCount() > errorCount) {
      continue;
    }
    if (!this.equals(lookupField.getContainingType())) {
      handler.error(this,"String_Node_Str",lookupField.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),lookupField.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),lookupField.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.LOOKUP_FIELD_NOT_IN_ENTITY);
      continue;
    }
    if (lookupField.isKey()) {
      handler.error(this,"String_Node_Str",lookupField.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),lookupField.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),lookupField.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.LOOKUP_FIELD_CANNOT_BE_KEY);
      continue;
    }
    lookupField.validate(handler);
    if (!isPrimitiveTypeField(lookupField)) {
      handler.error(this,"String_Node_Str",lookupField.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),lookupField.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),lookupField.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.LOOKUP_FIELD_MUST_BE_SIMPLE_TYPE);
    }
  }
}