Program: 88617
Project: 88617
Buggy source:
@Override public void run(){
  for (  final ValidationRule vr : this.getValidationRules()) {
    vr.getViolations().clear();
  }
  final ListIterator<Element> iterator=elements.listIterator();
  while (iterator.hasNext()) {
    final Element element=iterator.next();
    if (element instanceof Classifier) {
      final Classifier classifier=(Classifier)element;
      for (      final Generalization generalization : classifier.get_generalizationOfGeneral()) {
        if (!elements.contains(generalization.getSpecific())) {
          iterator.add(generalization.getSpecific());
          iterator.previous();
        }
      }
      for (      final InstanceSpecification instance : classifier.get_instanceSpecificationOfClassifier()) {
        if (!elements.contains(instance)) {
          iterator.add(instance);
          iterator.previous();
        }
      }
      for (      final Classifier general : classifier.getGeneral()) {
        if (!classifier.getName().equals(general.getName())) {
          final ValidationRuleViolation v=new ValidationRuleViolation(classifier,generalSpecificNameRule.getDescription() + "String_Node_Str" + general.getName()+ "String_Node_Str"+ classifier.getName());
          v.addAction(new RenameElementAction(general,classifier,"String_Node_Str"));
          v.addAction(new RenameElementAction(classifier,general,"String_Node_Str"));
          generalSpecificNameRule.addViolation(v);
        }
      }
      for (      final NamedElement ne : classifier.getInheritedMember()) {
        if (ne instanceof Property && ne instanceof RedefinableElement && !((RedefinableElement)ne).isLeaf()) {
          final RedefinableElement redefinableElement=(RedefinableElement)ne;
          RedefinableElement redefiningElement=null;
          for (          final Property p : classifier.getAttribute()) {
            if (p instanceof RedefinableElement && ((RedefinableElement)p).getRedefinedElement().contains(redefinableElement)) {
              redefiningElement=(RedefinableElement)p;
              break;
            }
          }
          if (redefiningElement == null) {
            final ValidationRuleViolation v=new ValidationRuleViolation(classifier,(redefinableElement instanceof TypedElement && ((TypedElement)redefinableElement).getType() != null ? "String_Node_Str" : "String_Node_Str") + attributeMissingRule.getDescription() + "String_Node_Str"+ redefinableElement.getQualifiedName());
            for (            final Property p : classifier.getAttribute()) {
              if (p.getName().equals(redefinableElement.getName()) && !p.hasRedefinedElement()) {
                v.addAction(new SetRedefinitionAction(p,redefinableElement,"String_Node_Str"));
              }
            }
            v.addAction(new RedefineAttributeAction(classifier,redefinableElement));
            if (redefinableElement instanceof TypedElement && ((TypedElement)redefinableElement).getType() != null) {
              v.addAction(new RedefineAttributeAction(classifier,redefinableElement,true,"String_Node_Str"));
            }
            attributeMissingRule.addViolation(v);
          }
 else {
            if ((redefiningElement.getName() == null && redefinableElement.getName() != null) || (redefiningElement.getName() != null && !redefiningElement.getName().equals(redefinableElement.getName()))) {
              final ValidationRuleViolation v=new ValidationRuleViolation(redefiningElement,nameRule.getDescription() + "String_Node_Str" + redefinableElement.getName()+ "String_Node_Str"+ redefiningElement.getName());
              v.addAction(new RenameElementAction(redefinableElement,redefiningElement,"String_Node_Str"));
              v.addAction(new RenameElementAction(redefiningElement,redefinableElement,"String_Node_Str"));
              nameRule.addViolation(v);
            }
            if (redefiningElement instanceof TypedElement && redefinableElement instanceof TypedElement) {
              final TypedElement redefiningTypedElement=(TypedElement)redefiningElement;
              final TypedElement redefinableTypedElement=(TypedElement)redefinableElement;
              if ((redefiningTypedElement.getType() == null && redefinableTypedElement.getType() != null) || (redefiningTypedElement.getType() != null && !redefiningTypedElement.getType().equals(redefinableTypedElement.getType()))) {
                if (redefiningTypedElement.getType() instanceof Classifier && redefinableTypedElement.getType() instanceof Classifier && ((Classifier)redefiningTypedElement.getType()).getGeneral().contains(redefinableTypedElement.getType())) {
                  iterator.add(((Classifier)redefiningTypedElement.getType()));
                  iterator.previous();
                }
 else {
                  final ValidationRuleViolation v=new ValidationRuleViolation(redefiningTypedElement,attributeTypeRule.getDescription() + "String_Node_Str" + (redefinableTypedElement.getType() != null ? redefinableTypedElement.getType().getQualifiedName() : "String_Node_Str")+ "String_Node_Str"+ (redefiningTypedElement.getType() != null ? redefiningTypedElement.getType().getQualifiedName() : "String_Node_Str"));
                  v.addAction(new RetypeElementAction(redefinableTypedElement,redefiningTypedElement,"String_Node_Str"));
                  v.addAction(new RetypeElementAction(redefiningTypedElement,redefinableTypedElement,"String_Node_Str"));
                  attributeTypeRule.addViolation(v);
                }
              }
            }
          }
        }
      }
    }
 else     if (element instanceof InstanceSpecification) {
      final InstanceSpecification instance=(InstanceSpecification)element;
      for (      final Slot slot : instance.getSlot()) {
        for (        final ValueSpecification vs : slot.getValue()) {
          final InstanceSpecification i;
          if (vs instanceof InstanceValue && (i=((InstanceValue)vs).getInstance()) != null && !elements.contains(i)) {
            iterator.add(i);
            iterator.previous();
          }
        }
      }
      if (!instance.hasClassifier()) {
        final ValidationRuleViolation v=new ValidationRuleViolation(instance,instanceClassifierExistenceRule.getDescription() + "String_Node_Str" + instance.getQualifiedName());
        v.addAction(new OpenSpecificationAction(instance));
        v.addAction(new SelectInContainmentTreeAction(instance));
        instanceClassifierExistenceRule.addViolation(v);
        continue;
      }
      final List<Property> missingProperties=new ArrayList<Property>();
      for (      final Classifier classifier : instance.getClassifier()) {
        for (        final Property property : CreateSlotsAction.collectSlottableProperties(classifier)) {
          boolean isDefined=false;
          for (          final Slot slot : instance.getSlot()) {
            if (slot.getDefiningFeature().equals(property)) {
              isDefined=true;
              break;
            }
          }
          if (!isDefined) {
            missingProperties.add(property);
          }
        }
      }
      if (!missingProperties.isEmpty()) {
        String suffix="String_Node_Str";
        if (instance.hasSlot()) {
          suffix+="String_Node_Str";
          for (int i=0; i < missingProperties.size(); i++) {
            final Property property=missingProperties.get(i);
            suffix+=property.getName() != null && !property.getName().isEmpty() ? property.getName() : "String_Node_Str";
            if (i != missingProperties.size() - 1) {
              suffix+="String_Node_Str";
            }
          }
        }
        final ValidationRuleViolation v=new ValidationRuleViolation(instance,(!instance.hasSlot() ? missingSlotsRule.getDescription().replaceFirst("String_Node_Str","String_Node_Str") : missingSlotsRule.getDescription()) + suffix);
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,false,false,false,"String_Node_Str"),"String_Node_Str"));
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,false,false,true,"String_Node_Str"),"String_Node_Str"));
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,false,true,true,"String_Node_Str"),"String_Node_Str"));
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,true,false,false,"String_Node_Str"),"String_Node_Str"));
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,true,false,true,"String_Node_Str"),"String_Node_Str"));
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,true,true,true,"String_Node_Str"),"String_Node_Str"));
        missingSlotsRule.addViolation(v);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  for (  final ValidationRule vr : this.getValidationRules()) {
    vr.getViolations().clear();
  }
  final ListIterator<Element> iterator=elements.listIterator();
  while (iterator.hasNext()) {
    final Element element=iterator.next();
    if (element instanceof Classifier) {
      final Classifier classifier=(Classifier)element;
      for (      final Generalization generalization : classifier.get_generalizationOfGeneral()) {
        if (!elements.contains(generalization.getSpecific())) {
          iterator.add(generalization.getSpecific());
          iterator.previous();
        }
      }
      for (      final InstanceSpecification instance : classifier.get_instanceSpecificationOfClassifier()) {
        if (!elements.contains(instance)) {
          iterator.add(instance);
          iterator.previous();
        }
      }
      for (      final Classifier general : classifier.getGeneral()) {
        if (!classifier.getName().equals(general.getName())) {
          final ValidationRuleViolation v=new ValidationRuleViolation(classifier,generalSpecificNameRule.getDescription() + "String_Node_Str" + general.getName()+ "String_Node_Str"+ classifier.getName());
          v.addAction(new RenameElementAction(general,classifier,"String_Node_Str"));
          v.addAction(new RenameElementAction(classifier,general,"String_Node_Str"));
          generalSpecificNameRule.addViolation(v);
        }
      }
      for (      final NamedElement ne : classifier.getInheritedMember()) {
        if (ne instanceof Property && ne instanceof RedefinableElement && !((RedefinableElement)ne).isLeaf()) {
          final RedefinableElement redefinableElement=(RedefinableElement)ne;
          RedefinableElement redefiningElement=null;
          for (          final Property p : classifier.getAttribute()) {
            if (redefinableElement instanceof Property && doesEventuallyRedefine(p,(Property)redefinableElement)) {
              redefiningElement=(RedefinableElement)p;
              break;
            }
          }
          if (redefiningElement == null) {
            final ValidationRuleViolation v=new ValidationRuleViolation(classifier,(redefinableElement instanceof TypedElement && ((TypedElement)redefinableElement).getType() != null ? "String_Node_Str" : "String_Node_Str") + attributeMissingRule.getDescription() + "String_Node_Str"+ redefinableElement.getQualifiedName());
            for (            final Property p : classifier.getAttribute()) {
              if (p.getName().equals(redefinableElement.getName()) && !p.hasRedefinedElement()) {
                v.addAction(new SetRedefinitionAction(p,redefinableElement,"String_Node_Str"));
              }
            }
            v.addAction(new RedefineAttributeAction(classifier,redefinableElement));
            if (redefinableElement instanceof TypedElement && ((TypedElement)redefinableElement).getType() != null) {
              v.addAction(new RedefineAttributeAction(classifier,redefinableElement,true,"String_Node_Str"));
            }
            attributeMissingRule.addViolation(v);
          }
 else {
            if ((redefiningElement.getName() == null && redefinableElement.getName() != null) || (redefiningElement.getName() != null && !redefiningElement.getName().equals(redefinableElement.getName()))) {
              final ValidationRuleViolation v=new ValidationRuleViolation(redefiningElement,nameRule.getDescription() + "String_Node_Str" + redefinableElement.getName()+ "String_Node_Str"+ redefiningElement.getName());
              v.addAction(new RenameElementAction(redefinableElement,redefiningElement,"String_Node_Str"));
              v.addAction(new RenameElementAction(redefiningElement,redefinableElement,"String_Node_Str"));
              nameRule.addViolation(v);
            }
            if (redefiningElement instanceof TypedElement && redefinableElement instanceof TypedElement) {
              final TypedElement redefiningTypedElement=(TypedElement)redefiningElement;
              final TypedElement redefinableTypedElement=(TypedElement)redefinableElement;
              if ((redefiningTypedElement.getType() == null && redefinableTypedElement.getType() != null) || (redefiningTypedElement.getType() != null && redefiningTypedElement.getType() instanceof Classifier && redefinableTypedElement.getType() instanceof Classifier && !doesEventuallyGeneralizeTo((Classifier)redefiningTypedElement.getType(),(Classifier)redefinableTypedElement.getType()))) {
                if (redefiningTypedElement.getType() instanceof Classifier && redefinableTypedElement.getType() instanceof Classifier && ((Classifier)redefiningTypedElement.getType()).getGeneral().contains(redefinableTypedElement.getType())) {
                  iterator.add(((Classifier)redefiningTypedElement.getType()));
                  iterator.previous();
                }
 else {
                  final ValidationRuleViolation v=new ValidationRuleViolation(redefiningTypedElement,attributeTypeRule.getDescription() + "String_Node_Str" + (redefinableTypedElement.getType() != null ? redefinableTypedElement.getType().getQualifiedName() : "String_Node_Str")+ "String_Node_Str"+ (redefiningTypedElement.getType() != null ? redefiningTypedElement.getType().getQualifiedName() : "String_Node_Str"));
                  v.addAction(new RetypeElementAction(redefinableTypedElement,redefiningTypedElement,"String_Node_Str"));
                  v.addAction(new RetypeElementAction(redefiningTypedElement,redefinableTypedElement,"String_Node_Str"));
                  attributeTypeRule.addViolation(v);
                }
              }
            }
          }
        }
      }
    }
 else     if (element instanceof InstanceSpecification) {
      final InstanceSpecification instance=(InstanceSpecification)element;
      for (      final Slot slot : instance.getSlot()) {
        for (        final ValueSpecification vs : slot.getValue()) {
          final InstanceSpecification i;
          if (vs instanceof InstanceValue && (i=((InstanceValue)vs).getInstance()) != null && !elements.contains(i)) {
            iterator.add(i);
            iterator.previous();
          }
        }
      }
      if (!instance.hasClassifier()) {
        final ValidationRuleViolation v=new ValidationRuleViolation(instance,instanceClassifierExistenceRule.getDescription() + "String_Node_Str" + instance.getQualifiedName());
        v.addAction(new OpenSpecificationAction(instance));
        v.addAction(new SelectInContainmentTreeAction(instance));
        instanceClassifierExistenceRule.addViolation(v);
        continue;
      }
      final List<Property> missingProperties=new ArrayList<Property>();
      for (      final Classifier classifier : instance.getClassifier()) {
        for (        final Property property : CreateSlotsAction.collectSlottableProperties(classifier)) {
          boolean isDefined=false;
          for (          final Slot slot : instance.getSlot()) {
            if (slot.getDefiningFeature().equals(property)) {
              isDefined=true;
              break;
            }
          }
          if (!isDefined) {
            missingProperties.add(property);
          }
        }
      }
      if (!missingProperties.isEmpty()) {
        String suffix="String_Node_Str";
        if (instance.hasSlot()) {
          suffix+="String_Node_Str";
          for (int i=0; i < missingProperties.size(); i++) {
            final Property property=missingProperties.get(i);
            suffix+=property.getName() != null && !property.getName().isEmpty() ? property.getName() : "String_Node_Str";
            if (i != missingProperties.size() - 1) {
              suffix+="String_Node_Str";
            }
          }
        }
        final ValidationRuleViolation v=new ValidationRuleViolation(instance,(!instance.hasSlot() ? missingSlotsRule.getDescription().replaceFirst("String_Node_Str","String_Node_Str") : missingSlotsRule.getDescription()) + suffix);
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,false,false,false,"String_Node_Str"),"String_Node_Str"));
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,false,false,true,"String_Node_Str"),"String_Node_Str"));
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,false,true,true,"String_Node_Str"),"String_Node_Str"));
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,true,false,false,"String_Node_Str"),"String_Node_Str"));
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,true,false,true,"String_Node_Str"),"String_Node_Str"));
        v.addAction(IndeterminateProgressMonitorProxy.doubleWrap(new CreateSlotsAction(instance,true,true,true,"String_Node_Str"),"String_Node_Str"));
        missingSlotsRule.addViolation(v);
      }
    }
  }
}