nus-yam/ex-repair huggingface dataset:
Program: 93587
Project: 93587
Buggy source:
protected void attachListeners(final MergeSourceViewer viewer){
  final StyledText textWidget=viewer.getSourceViewer().getTextWidget();
  textWidget.addFocusListener(new FocusListener(){
    public void focusLost(    FocusEvent e){
      getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(),null);
      getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(),null);
    }
    public void focusGained(    FocusEvent e){
      getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(),fUndoAction);
      getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(),fRedoAction);
    }
  }
);
  viewer.getSourceViewer().addTextListener(new ITextListener(){
    public void textChanged(    TextEvent event){
      final Object oldInput=getInput();
      if (event.getDocumentEvent() != null && oldInput instanceof CompareInputAdapter) {
        if (oldInput instanceof CompareInputAdapter) {
          final AttributeChange diff=(AttributeChange)((CompareInputAdapter)oldInput).getComparisonObject();
          final EAttribute eAttribute=diff.getAttribute();
          final Match match=diff.getMatch();
          final IEqualityHelper equalityHelper=match.getComparison().getEqualityHelper();
          updateModel(diff,eAttribute,equalityHelper,match.getLeft(),true);
          updateModel(diff,eAttribute,equalityHelper,match.getRight(),false);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
protected void attachListeners(final MergeSourceViewer viewer){
  final StyledText textWidget=viewer.getSourceViewer().getTextWidget();
  textWidget.addFocusListener(new FocusListener(){
    public void focusLost(    FocusEvent e){
      getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(),null);
      getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(),null);
    }
    public void focusGained(    FocusEvent e){
      getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(),fUndoAction);
      getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(),fRedoAction);
    }
  }
);
  viewer.getSourceViewer().addTextListener(new ITextListener(){
    public void textChanged(    TextEvent event){
      final Object oldInput=getInput();
      if (event.getDocumentEvent() != null && oldInput instanceof CompareInputAdapter) {
        final AttributeChange diff=(AttributeChange)((CompareInputAdapter)oldInput).getComparisonObject();
        final EAttribute eAttribute=diff.getAttribute();
        final Match match=diff.getMatch();
        final IEqualityHelper equalityHelper=match.getComparison().getEqualityHelper();
        updateModel(diff,eAttribute,equalityHelper,match.getLeft(),true);
        updateModel(diff,eAttribute,equalityHelper,match.getRight(),false);
      }
    }
  }
);
}
Program: 93588
Project: 93588
Buggy source:
public void textChanged(TextEvent event){
  final Object oldInput=getInput();
  if (event.getDocumentEvent() != null && oldInput instanceof CompareInputAdapter) {
    if (oldInput instanceof CompareInputAdapter) {
      final AttributeChange diff=(AttributeChange)((CompareInputAdapter)oldInput).getComparisonObject();
      final EAttribute eAttribute=diff.getAttribute();
      final Match match=diff.getMatch();
      final IEqualityHelper equalityHelper=match.getComparison().getEqualityHelper();
      updateModel(diff,eAttribute,equalityHelper,match.getLeft(),true);
      updateModel(diff,eAttribute,equalityHelper,match.getRight(),false);
    }
  }
}

Fixed version (ground truth):
public void textChanged(TextEvent event){
  final Object oldInput=getInput();
  if (event.getDocumentEvent() != null && oldInput instanceof CompareInputAdapter) {
    final AttributeChange diff=(AttributeChange)((CompareInputAdapter)oldInput).getComparisonObject();
    final EAttribute eAttribute=diff.getAttribute();
    final Match match=diff.getMatch();
    final IEqualityHelper equalityHelper=match.getComparison().getEqualityHelper();
    updateModel(diff,eAttribute,equalityHelper,match.getLeft(),true);
    updateModel(diff,eAttribute,equalityHelper,match.getRight(),false);
  }
}
Program: 93589
Project: 93589
Buggy source:
/** 
 * Compares two values as arrays, checking that their length and content match each other.
 * @param object1 First of the two objects to compare here.
 * @param object2 Second of the two objects to compare here.
 * @return <code>true</code> if these two arrays are to be considered equal, <code>false</code> otherwise.
 */
private boolean matchingArrays(Object object1,Object object2){
  boolean equal=true;
  final int length1=Array.getLength(object1);
  if (length1 != Array.getLength(object2)) {
    equal=true;
  }
 else {
    for (int i=0; i < length1 && equal; i++) {
      final Object element1=Array.get(object1,i);
      final Object element2=Array.get(object2,i);
      equal=matchingValues(element1,element2);
    }
  }
  return equal;
}

Fixed version (ground truth):
/** 
 * Compares two values as arrays, checking that their length and content match each other.
 * @param object1 First of the two objects to compare here.
 * @param object2 Second of the two objects to compare here.
 * @return <code>true</code> if these two arrays are to be considered equal, <code>false</code> otherwise.
 */
private boolean matchingArrays(Object object1,Object object2){
  boolean equal=true;
  final int length1=Array.getLength(object1);
  if (length1 != Array.getLength(object2)) {
    equal=false;
  }
 else {
    for (int i=0; i < length1 && equal; i++) {
      final Object element1=Array.get(object1,i);
      final Object element2=Array.get(object2,i);
      equal=matchingValues(element1,element2);
    }
  }
  return equal;
}
Program: 93590
Project: 93590
Buggy source:
private Set<IStorage> resolveTraversal(IFile file,Set<URI> bounds,IStorageProviderAccessor storageAccessor){
  final Set<IStorage> traversal=new LinkedHashSet<IStorage>();
  final Iterable<URI> dependencies=getDependenciesOf(file,bounds);
  for (  URI uri : dependencies) {
    final IFile dependencyFile=getFileAt(uri);
    try {
      if (!storageAccessor.isInSync(dependencyFile)) {
        traversal.add(dependencyFile);
      }
    }
 catch (    CoreException e) {
    }
  }
  return traversal;
}

Fixed version (ground truth):
private Set<IStorage> resolveTraversal(IFile file,Set<URI> bounds){
  final Set<IStorage> traversal=new LinkedHashSet<IStorage>();
  final Iterable<URI> dependencies=getDependenciesOf(file,bounds);
  for (  URI uri : dependencies) {
    traversal.add(getFileAt(uri));
  }
  return traversal;
}
Program: 93592
Project: 93592
Buggy source:
/** 
 * Constructs our uri converter given its delegate.
 * @param delegate The delegate URI Converter.
 */
public StorageURIConverter(URIConverter delegate){
  super(delegate);
  this.loadedRevisions=Sets.newLinkedHashSet();
}

Fixed version (ground truth):
/** 
 * Constructs our uri converter given its delegate.
 * @param delegate The delegate URI Converter.
 */
public StorageURIConverter(URIConverter delegate){
  super(delegate);
  this.loadedRevisions=Sets.newSetFromMap(new ConcurrentHashMap<IStorage,Boolean>());
}
Program: 93593
Project: 93593
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#getResource(org.eclipse.emf.common.util.URI,boolean)
 */
@Override public Resource getResource(URI uri,boolean loadOnDemand){
  Resource demanded=uriCache.get(uri);
  if (demanded == null) {
    final EPackage ePackage=getPackageRegistry().getEPackage(uri.toString());
    if (ePackage != null) {
      demanded=ePackage.eResource();
      uriCache.put(uri,demanded);
    }
 else {
    }
  }
  return demanded;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#getResource(org.eclipse.emf.common.util.URI,boolean)
 */
@Override public Resource getResource(URI uri,boolean loadOnDemand){
  Resource demanded=uriCache.get(uri);
  if (demanded == null) {
    final EPackage ePackage=getPackageRegistry().getEPackage(uri.toString());
    if (ePackage != null) {
      demanded=ePackage.eResource();
      demanded=uriCache.putIfAbsent(uri,demanded);
    }
 else {
    }
  }
  return demanded;
}
Program: 93594
Project: 93594
Buggy source:
public Set<URI> discoverCrossReferences(Resource resource,IProgressMonitor monitor){
  resource.eSetDeliver(false);
  final List<EObject> roots=((InternalEList<EObject>)resource.getContents()).basicList();
  final Iterator<EObject> resourceContent=roots.iterator();
  final Set<URI> crossReferencedResources=new LinkedHashSet<URI>();
  while (resourceContent.hasNext()) {
    final EObject eObject=resourceContent.next();
    crossReferencedResources.addAll(resolveCrossReferences(eObject));
    final TreeIterator<EObject> objectChildren=basicEAllContents(eObject);
    while (objectChildren.hasNext()) {
      final EObject child=objectChildren.next();
      if (child.eIsProxy()) {
        final URI proxyURI=((InternalEObject)child).eProxyURI().trimFragment();
        crossReferencedResources.add(proxyURI);
      }
 else {
        crossReferencedResources.addAll(resolveCrossReferences(child));
      }
    }
  }
  return crossReferencedResources;
}

Fixed version (ground truth):
public Set<URI> discoverCrossReferences(Resource resource,IProgressMonitor monitor){
  resource.eSetDeliver(false);
  final List<EObject> roots=((InternalEList<EObject>)resource.getContents()).basicList();
  final Iterator<EObject> resourceContent=roots.iterator();
  final Set<URI> crossReferencedResources=new LinkedHashSet<URI>();
  while (resourceContent.hasNext()) {
    final EObject eObject=resourceContent.next();
    crossReferencedResources.addAll(resolveCrossReferences(eObject));
    final TreeIterator<EObject> objectChildren=basicEAllContents(eObject);
    while (objectChildren.hasNext()) {
      final EObject child=objectChildren.next();
      if (child.eIsProxy()) {
        final URI proxyURI=((InternalEObject)child).eProxyURI().trimFragment();
        crossReferencedResources.add(proxyURI);
      }
 else {
        crossReferencedResources.addAll(resolveCrossReferences(child));
      }
      if (monitor.isCanceled()) {
        return Collections.emptySet();
      }
    }
  }
  return crossReferencedResources;
}
Program: 93595
Project: 93595
Buggy source:
/** 
 * {@inheritDoc}
 */
public void createMatches(Comparison comparison,Iterator<? extends EObject> leftEObjects,Iterator<? extends EObject> rightEObjects,Iterator<? extends EObject> originEObjects,Monitor monitor){
  Monitor subMonitor=new BasicMonitor();
  subMonitor.beginTask("String_Node_Str",1);
  int nbElements=0;
  int lastSegment=0;
  while (leftEObjects.hasNext() || rightEObjects.hasNext() || leftEObjects.hasNext()) {
    if (leftEObjects.hasNext()) {
      EObject next=leftEObjects.next();
      nbElements++;
      index.index(next,Side.LEFT);
      eObjectsToSide.put(next,Side.LEFT);
    }
    if (rightEObjects.hasNext()) {
      EObject next=rightEObjects.next();
      index.index(next,Side.RIGHT);
      eObjectsToSide.put(next,Side.RIGHT);
    }
    if (originEObjects.hasNext()) {
      EObject next=originEObjects.next();
      index.index(next,Side.ORIGIN);
      eObjectsToSide.put(next,Side.ORIGIN);
    }
    if (nbElements / NB_ELEMENTS_BETWEEN_MATCH_AHEAD > lastSegment) {
      matchAheadOfTime(comparison,subMonitor);
      lastSegment++;
    }
  }
  subMonitor.worked(1);
  subMonitor.done();
  subMonitor=new BasicMonitor();
  subMonitor.beginTask("String_Node_Str",nbElements);
  matchIndexedObjects(comparison,subMonitor);
  createUnmatchesForRemainingObjects(comparison);
  subMonitor.done();
  restructureMatchModel(comparison);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void createMatches(Comparison comparison,Iterator<? extends EObject> leftEObjects,Iterator<? extends EObject> rightEObjects,Iterator<? extends EObject> originEObjects,Monitor monitor){
  Monitor subMonitor=new BasicMonitor();
  subMonitor.beginTask("String_Node_Str",1);
  int nbElements=0;
  int lastSegment=0;
  while (leftEObjects.hasNext() || rightEObjects.hasNext() || originEObjects.hasNext()) {
    if (leftEObjects.hasNext()) {
      EObject next=leftEObjects.next();
      nbElements++;
      index.index(next,Side.LEFT);
      eObjectsToSide.put(next,Side.LEFT);
    }
    if (rightEObjects.hasNext()) {
      EObject next=rightEObjects.next();
      index.index(next,Side.RIGHT);
      eObjectsToSide.put(next,Side.RIGHT);
    }
    if (originEObjects.hasNext()) {
      EObject next=originEObjects.next();
      index.index(next,Side.ORIGIN);
      eObjectsToSide.put(next,Side.ORIGIN);
    }
    if (nbElements / NB_ELEMENTS_BETWEEN_MATCH_AHEAD > lastSegment) {
      matchAheadOfTime(comparison,subMonitor);
      lastSegment++;
    }
  }
  subMonitor.worked(1);
  subMonitor.done();
  subMonitor=new BasicMonitor();
  subMonitor.beginTask("String_Node_Str",nbElements);
  matchIndexedObjects(comparison,subMonitor);
  createUnmatchesForRemainingObjects(comparison);
  subMonitor.done();
  restructureMatchModel(comparison);
}
Program: 93596
Project: 93596
Buggy source:
/** 
 * {@inheritDoc}
 */
public void createMatches(Comparison comparison,Iterator<? extends EObject> leftEObjects,Iterator<? extends EObject> rightEObjects,Iterator<? extends EObject> originEObjects,Monitor monitor){
  Monitor subMonitor=new BasicMonitor();
  subMonitor.beginTask("String_Node_Str",1);
  int nbElements=0;
  int lastSegment=0;
  while (leftEObjects.hasNext() || rightEObjects.hasNext() || leftEObjects.hasNext()) {
    if (leftEObjects.hasNext()) {
      EObject next=leftEObjects.next();
      nbElements++;
      index.index(next,Side.LEFT);
      eObjectsToSide.put(next,Side.LEFT);
    }
    if (rightEObjects.hasNext()) {
      EObject next=rightEObjects.next();
      index.index(next,Side.RIGHT);
      eObjectsToSide.put(next,Side.RIGHT);
    }
    if (originEObjects.hasNext()) {
      EObject next=originEObjects.next();
      index.index(next,Side.ORIGIN);
      eObjectsToSide.put(next,Side.ORIGIN);
    }
    if (nbElements / NB_ELEMENTS_BETWEEN_MATCH_AHEAD > lastSegment) {
      matchAheadOfTime(comparison,subMonitor);
      lastSegment++;
    }
  }
  subMonitor.worked(1);
  subMonitor.done();
  subMonitor=new BasicMonitor();
  subMonitor.beginTask("String_Node_Str",nbElements);
  matchIndexedObjects(comparison,subMonitor);
  createUnmatchesForRemainingObjects(comparison);
  subMonitor.done();
  restructureMatchModel(comparison);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void createMatches(Comparison comparison,Iterator<? extends EObject> leftEObjects,Iterator<? extends EObject> rightEObjects,Iterator<? extends EObject> originEObjects,Monitor monitor){
  Monitor subMonitor=new BasicMonitor();
  subMonitor.beginTask("String_Node_Str",1);
  int nbElements=0;
  int lastSegment=0;
  while (leftEObjects.hasNext() || rightEObjects.hasNext() || originEObjects.hasNext()) {
    if (leftEObjects.hasNext()) {
      EObject next=leftEObjects.next();
      nbElements++;
      index.index(next,Side.LEFT);
      eObjectsToSide.put(next,Side.LEFT);
    }
    if (rightEObjects.hasNext()) {
      EObject next=rightEObjects.next();
      index.index(next,Side.RIGHT);
      eObjectsToSide.put(next,Side.RIGHT);
    }
    if (originEObjects.hasNext()) {
      EObject next=originEObjects.next();
      index.index(next,Side.ORIGIN);
      eObjectsToSide.put(next,Side.ORIGIN);
    }
    if (nbElements / NB_ELEMENTS_BETWEEN_MATCH_AHEAD > lastSegment) {
      matchAheadOfTime(comparison,subMonitor);
      lastSegment++;
    }
  }
  subMonitor.worked(1);
  subMonitor.done();
  subMonitor=new BasicMonitor();
  subMonitor.beginTask("String_Node_Str",nbElements);
  matchIndexedObjects(comparison,subMonitor);
  createUnmatchesForRemainingObjects(comparison);
  subMonitor.done();
  restructureMatchModel(comparison);
}
Program: 93597
Project: 93597
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.MergeAction#getDifferencesToMerge()
 */
@Override protected List<Diff> getDifferencesToMerge(){
  Iterable<Diff> differences=filter(comparison.getDifferences(),or(WITHOUT_CONFLICT,hasState(DifferenceState.UNRESOLVED)));
  return newArrayList(differences);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.MergeAction#getDifferencesToMerge()
 */
@Override protected List<Diff> getDifferencesToMerge(){
  Iterable<Diff> differences=filter(comparison.getDifferences(),and(WITHOUT_CONFLICT,hasState(DifferenceState.UNRESOLVED)));
  return newArrayList(differences);
}
Program: 93598
Project: 93598
Buggy source:
public boolean apply(EObject input){
  boolean ret=false;
  if (input instanceof Diff && !(input instanceof ResourceAttachmentChange)) {
    final Diff diff=(Diff)input;
    final Conflict conflict=diff.getConflict();
    if (conflict == null || ConflictKind.PSEUDO == conflict.getKind()) {
      final EObject grandParent=diff.getMatch().eContainer();
      if (grandParent instanceof Match) {
        ImmutableSet<EObject> containementDifferenceValues=MatchItemProviderSpec.containmentReferencesValues((Match)grandParent);
        if (MatchItemProviderSpec.matchOfContainmentDiff(containementDifferenceValues).apply(diff.getMatch())) {
          ret=true;
        }
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
public boolean apply(EObject input){
  boolean ret=false;
  if (input instanceof Diff && !(input instanceof ResourceAttachmentChange)) {
    final Diff diff=(Diff)input;
    final Conflict conflict=diff.getConflict();
    if (conflict == null || ConflictKind.PSEUDO == conflict.getKind()) {
      final Match match=diff.getMatch();
      final EObject grandParent=match.eContainer();
      if (grandParent instanceof Match) {
        ImmutableSet<EObject> containementDifferenceValues=MatchItemProviderSpec.containmentReferencesValues((Match)grandParent);
        if (MatchItemProviderSpec.matchOfContainmentDiff(containementDifferenceValues).apply(match)) {
          ret=true;
        }
 else         if (match.getLeft() == null && match.getRight() == null && match.getOrigin() == null) {
          ret=true;
        }
      }
    }
  }
  return ret;
}
Program: 93600
Project: 93600
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.diagram.ide.ui.internal.contentmergeviewer.diagram.DiagramContentMergeViewer.AbstractDecoratorManager#createAndRegisterDecorator(org.eclipse.emf.compare.Diff,org.eclipse.gmf.runtime.notation.View,org.eclipse.draw2d.IFigure,org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.IMergeViewer.MergeViewerSide)
 */
@Override protected Marker createAndRegisterDecorator(Diff diff,View referenceView,IFigure referenceFigure,MergeViewerSide targetSide){
  Marker marker=createMarker(diff,referenceView,referenceFigure,targetSide);
  if (marker != null) {
    List<Marker> markers=fMarkerRegistry.get(diff);
    if (markers == null) {
      markers=Collections.synchronizedList(new ArrayList<Marker>());
      fMarkerRegistry.put(diff,markers);
    }
    markers.add(marker);
  }
  return marker;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.diagram.ide.ui.internal.contentmergeviewer.diagram.DiagramContentMergeViewer.AbstractDecoratorManager#createAndRegisterDecorator(org.eclipse.emf.compare.Diff,org.eclipse.gmf.runtime.notation.View,org.eclipse.draw2d.IFigure,org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.IMergeViewer.MergeViewerSide)
 */
@Override protected Marker createAndRegisterDecorator(Diff diff,View referenceView,IFigure referenceFigure,MergeViewerSide targetSide){
  Marker marker=createMarker(diff,referenceView,referenceFigure,targetSide);
  if (marker != null) {
    fMarkerRegistry.put(diff,marker);
  }
  return marker;
}
Program: 93601
Project: 93601
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.diagram.ide.ui.internal.contentmergeviewer.diagram.DiagramContentMergeViewer.AbstractDecoratorManager#getDecorators(org.eclipse.emf.compare.Diff)
 */
@Override protected List<Marker> getDecorators(Diff difference){
  return fMarkerRegistry.get(difference);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.diagram.ide.ui.internal.contentmergeviewer.diagram.DiagramContentMergeViewer.AbstractDecoratorManager#getDecorators(org.eclipse.emf.compare.Diff)
 */
@Override protected Collection<Marker> getDecorators(Diff difference){
  return fMarkerRegistry.get(difference);
}
Program: 93602
Project: 93602
Buggy source:
/** 
 * It manages the display of the given decorators.
 * @param decorators The decorators to handle.
 * @param isAdd True if it has to be revealed, False otherwise.
 * @param areMain It indicates if the given decorators to handle are considered as the main ones (the ones directly linked to the selected difference).
 */
protected void handleDecorators(List<? extends AbstractDecorator> decorators,boolean isAdd,boolean areMain){
  for (  AbstractDecorator decorator : decorators) {
    handleDecorator(decorator,isAdd,areMain);
  }
}

Fixed version (ground truth):
/** 
 * It manages the display of the given decorators.
 * @param decorators The decorators to handle.
 * @param isAdd True if it has to be revealed, False otherwise.
 * @param areMain It indicates if the given decorators to handle are considered as the main ones (the ones directly linked to the selected difference).
 */
protected void handleDecorators(Collection<? extends AbstractDecorator> decorators,boolean isAdd,boolean areMain){
  for (  AbstractDecorator decorator : decorators) {
    handleDecorator(decorator,isAdd,areMain);
  }
}
Program: 93603
Project: 93603
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.diagram.ide.ui.internal.contentmergeviewer.DiagramCompareContentMergeViewer#updateContent(java.lang.Object,java.lang.Object,java.lang.Object)
 */
@Override protected void updateContent(Object ancestor,Object left,Object right){
  super.updateContent(ancestor,left,right);
  getLeftMergeViewer().getGraphicalViewer().flush();
  getRightMergeViewer().getGraphicalViewer().flush();
  getAncestorMergeViewer().getGraphicalViewer().flush();
  if (left instanceof IDiagramDiffAccessor) {
    IDiagramDiffAccessor input=(IDiagramDiffAccessor)left;
    if (fCurrentSelectedDiff != null && fCurrentSelectedDiff.getState() != DifferenceState.MERGED) {
      fDecoratorsManager.hideDecorators(fCurrentSelectedDiff);
    }
    Diff diff=input.getDiff();
    fCurrentSelectedDiff=diff;
    if (diff.getState() != DifferenceState.MERGED) {
      fDecoratorsManager.revealDecorators(diff);
    }
  }
 else   if (left instanceof IDiagramNodeAccessor) {
    if (fCurrentSelectedDiff != null && fCurrentSelectedDiff.getState() != DifferenceState.MERGED) {
      fDecoratorsManager.hideDecorators(fCurrentSelectedDiff);
    }
    fCurrentSelectedDiff=null;
  }
  updateToolItems();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.diagram.ide.ui.internal.contentmergeviewer.DiagramCompareContentMergeViewer#updateContent(java.lang.Object,java.lang.Object,java.lang.Object)
 */
@Override protected void updateContent(Object ancestor,Object left,Object right){
  fDecoratorsManager.hideAll();
  fDecoratorsManager.removeAll();
  super.updateContent(ancestor,left,right);
  getLeftMergeViewer().getGraphicalViewer().flush();
  getRightMergeViewer().getGraphicalViewer().flush();
  getAncestorMergeViewer().getGraphicalViewer().flush();
  if (left instanceof IDiagramNodeAccessor) {
    if (left instanceof IDiagramDiffAccessor) {
      IDiagramDiffAccessor input=(IDiagramDiffAccessor)left;
      Diff diff=input.getDiff();
      if (diff.getState() != DifferenceState.MERGED && diff != fCurrentSelectedDiff) {
        fDecoratorsManager.revealDecorators(diff);
      }
      fCurrentSelectedDiff=diff;
    }
 else {
      fCurrentSelectedDiff=null;
    }
  }
  updateToolItems();
}
Program: 93604
Project: 93604
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.AbstractStructuralFeatureAccessor.ui.internal.contentmergeviewer.provider.BasicStructuralFeatureAccessorImpl#getItems()
 */
public ImmutableList<? extends IMergeViewerItem> getItems(){
  Object thisSideValue=getValue(getSide());
  if (thisSideValue == null && getSide() == MergeViewerSide.ANCESTOR) {
    return ImmutableList.of();
  }
  Object leftValue=getValue(MergeViewerSide.LEFT);
  Object rightValue=getValue(MergeViewerSide.RIGHT);
  Object ancestorValue=getValue(MergeViewerSide.ANCESTOR);
  Diff diff=getFirst(getDifferences(),null);
  final ImmutableList<? extends IMergeViewerItem> ret;
  if (thisSideValue == null) {
    IMergeViewerItem insertionPoint=new MergeViewerItem(getComparison(),diff,leftValue,rightValue,ancestorValue,getSide(),getAdapterFactory());
    ret=ImmutableList.of(insertionPoint);
  }
 else {
    IMergeViewerItem matchedObject=new MergeViewerItem(getComparison(),diff,leftValue,rightValue,ancestorValue,getSide(),getAdapterFactory());
    ret=ImmutableList.of(matchedObject);
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.AbstractStructuralFeatureAccessor.ui.internal.contentmergeviewer.provider.BasicStructuralFeatureAccessorImpl#getItems()
 */
public ImmutableList<? extends IMergeViewerItem> getItems(){
  Object thisSideValue=getValue(getSide());
  if (thisSideValue == null && getSide() == MergeViewerSide.ANCESTOR) {
    return ImmutableList.of();
  }
  Object leftValue=getValue(MergeViewerSide.LEFT);
  Object rightValue=getValue(MergeViewerSide.RIGHT);
  Object ancestorValue=getValue(MergeViewerSide.ANCESTOR);
  Diff diff=getInitialDiff();
  final ImmutableList<? extends IMergeViewerItem> ret;
  if (thisSideValue == null) {
    IMergeViewerItem insertionPoint=new MergeViewerItem(getComparison(),diff,leftValue,rightValue,ancestorValue,getSide(),getAdapterFactory());
    ret=ImmutableList.of(insertionPoint);
  }
 else {
    IMergeViewerItem matchedObject=new MergeViewerItem(getComparison(),diff,leftValue,rightValue,ancestorValue,getSide(),getAdapterFactory());
    ret=ImmutableList.of(matchedObject);
  }
  return ret;
}
Program: 93605
Project: 93605
Buggy source:
/** 
 * It checks that the given view represents an element of a list.
 * @param view The view.
 * @return True it it is an element of a list.
 */
protected boolean isNodeList(View view){
  return view.eContainer() instanceof BasicCompartment;
}

Fixed version (ground truth):
/** 
 * It checks that the given part represents an element of a list.
 * @param part The part.
 * @return True it it represents an element of a list.
 */
private boolean isNodeList(EditPart part){
  return part instanceof ListItemEditPart || isInListContainer(part);
}
Program: 93607
Project: 93607
Buggy source:
/** 
 * Returns the current resource on the given side of the given comparison.
 * @param comparison The given comparison.
 * @param side The given side.
 * @return The current resource on the given side of the given comparison.
 */
public static Resource getResource(Comparison comparison,MergeViewerSide side,Diff diff){
  Resource resource=null;
  Collection<MatchResource> matchResources=comparison.getMatchedResources();
  String diffResourceURI=null;
  if (diff != null) {
    diffResourceURI=((ResourceAttachmentChange)diff).getResourceURI();
  }
  for (  MatchResource matchResource : matchResources) {
switch (side) {
case ANCESTOR:
      resource=matchResource.getOrigin();
    break;
case LEFT:
  resource=matchResource.getLeft();
break;
case RIGHT:
resource=matchResource.getRight();
break;
default :
throw new IllegalStateException();
}
if (resource != null && diffResourceURI != null) {
URI resourceURI=resource.getURI();
if (diffResourceURI.equals(resourceURI.toString())) {
return resource;
}
 else if (side == MergeViewerSide.RIGHT && diffResourceURI.equals(matchResource.getLeftURI())) {
return resource;
}
 else if (side == MergeViewerSide.LEFT && diffResourceURI.equals(matchResource.getRightURI())) {
return resource;
}
 else if (side == MergeViewerSide.ANCESTOR && diffResourceURI.equals(matchResource.getOriginURI())) {
return resource;
}
}
}
return resource;
}

Fixed version (ground truth):
/** 
 * Returns the current resource on the given side of the given comparison.
 * @param comparison The given comparison.
 * @param side The given side.
 * @return The current resource on the given side of the given comparison.
 */
public static Resource getResource(Comparison comparison,MergeViewerSide side,Diff diff){
  Resource resource=null;
  Collection<MatchResource> matchResources=comparison.getMatchedResources();
  String diffResourceURI=null;
  if (diff != null) {
    diffResourceURI=((ResourceAttachmentChange)diff).getResourceURI();
  }
  for (  MatchResource matchResource : matchResources) {
switch (side) {
case ANCESTOR:
      resource=matchResource.getOrigin();
    break;
case LEFT:
  resource=matchResource.getLeft();
break;
case RIGHT:
resource=matchResource.getRight();
break;
default :
throw new IllegalStateException();
}
if (resource != null && diffResourceURI != null) {
URI resourceURI=resource.getURI();
if (diffResourceURI.equals(resourceURI.toString())) {
return resource;
}
 else if (side == MergeViewerSide.RIGHT && (diffResourceURI.equals(matchResource.getLeftURI()) || diffResourceURI.equals(matchResource.getOriginURI()))) {
return resource;
}
 else if (side == MergeViewerSide.LEFT && (diffResourceURI.equals(matchResource.getRightURI()) || diffResourceURI.equals(matchResource.getOriginURI()))) {
return resource;
}
 else if (side == MergeViewerSide.ANCESTOR && (diffResourceURI.equals(matchResource.getLeftURI()) || diffResourceURI.equals(matchResource.getRightURI()))) {
return resource;
}
}
}
return resource;
}
Program: 93608
Project: 93608
Buggy source:
/** 
 * Check if the moving of the node is over the threshold (in pixels) specified in the emf compare preference page.
 * @param diff The difference.
 * @return True if it is over the threshold.
 */
private boolean isOverThreshold(AttributeChange diff){
  final Comparison comparison=diff.getMatch().getComparison();
  final EObject left=MatchUtil.getContainer(comparison,diff);
  final EObject right=MatchUtil.getOriginContainer(comparison,diff);
  if (left instanceof Bounds && right instanceof Bounds) {
    final int leftX=((Bounds)left).getX();
    final int leftY=((Bounds)left).getY();
    final int rightX=((Bounds)right).getX();
    final int rightY=((Bounds)right).getY();
    final int deltaX=Math.abs(leftX - rightX);
    final int deltaY=Math.abs(leftY - rightY);
    final int threshold=configuration.getMoveThreshold();
    return deltaX + deltaY > threshold;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check if the moving of the node is over the threshold (in pixels) specified in the emf compare preference page.
 * @param diff The difference.
 * @return True if it is over the threshold.
 */
private boolean isOverThreshold(AttributeChange diff){
  final Comparison comparison=diff.getMatch().getComparison();
  final EObject left=MatchUtil.getContainer(comparison,diff);
  final EObject right=MatchUtil.getOriginContainer(comparison,diff);
  if (left instanceof Bounds && right instanceof Bounds) {
    final int leftX=((Bounds)left).getX();
    final int leftY=((Bounds)left).getY();
    final int rightX=((Bounds)right).getX();
    final int rightY=((Bounds)right).getY();
    final int deltaX=Math.abs(leftX - rightX);
    final int deltaY=Math.abs(leftY - rightY);
    int threshold=0;
    if (configuration != null) {
      threshold=configuration.getMoveThreshold();
    }
    return deltaX + deltaY > threshold;
  }
  return false;
}
Program: 93609
Project: 93609
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.internal.postprocessor.factories.AbstractChangeFactory#setRefiningChanges(org.eclipse.emf.compare.diagram.internal.extensions.DiagramDiff,org.eclipse.emf.compare.DifferenceKind,org.eclipse.emf.compare.Diff)
 */
@Override public void setRefiningChanges(Diff extension,DifferenceKind extensionKind,Diff refiningDiff){
  extension.getRefinedBy().add(refiningDiff);
  if (extensionKind != DifferenceKind.MOVE) {
    extension.getRefinedBy().addAll(getAllContainedDifferences(refiningDiff));
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.internal.postprocessor.factories.AbstractChangeFactory#setRefiningChanges(org.eclipse.emf.compare.diagram.internal.extensions.DiagramDiff,org.eclipse.emf.compare.DifferenceKind,org.eclipse.emf.compare.Diff)
 */
@Override public void setRefiningChanges(Diff extension,DifferenceKind extensionKind,Diff refiningDiff){
  extension.getRefinedBy().add(refiningDiff);
  extension.getRefinedBy().addAll(getAllContainedDifferences(refiningDiff));
}
Program: 93610
Project: 93610
Buggy source:
/** 
 * Get all the add and delete changes under the given match.
 * @param comparison The comparison.
 * @param match The match
 * @return The found differences.
 */
private Set<Diff> getAllContainedDifferences(Comparison comparison,Match match){
  final Set<Diff> result=Sets.newLinkedHashSet();
  final Set<Match> prune=Sets.newLinkedHashSet();
  for (  Diff candidate : match.getDifferences()) {
    if (!getExtensionKind().isInstance(candidate)) {
      if (!isAMainRefiningDifference(candidate)) {
        result.add(candidate);
      }
 else       if (candidate instanceof ReferenceChange && ((ReferenceChange)candidate).getReference().isContainment()) {
        prune.add(comparison.getMatch(((ReferenceChange)candidate).getValue()));
      }
    }
  }
  for (  Match submatch : match.getSubmatches()) {
    if (!prune.contains(submatch)) {
      result.addAll(getAllContainedDifferences(comparison,submatch));
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Get all the add and delete changes under the given match.
 * @param comparison The comparison.
 * @param match The match
 * @return The found differences.
 */
private Set<Diff> getAllContainedDifferences(Comparison comparison,Match match){
  final Set<Diff> result=Sets.newLinkedHashSet();
  final Set<Match> prune=Sets.newLinkedHashSet();
  for (  Diff candidate : match.getDifferences()) {
    if (!getExtensionKind().isInstance(candidate)) {
      if (getRelatedExtensionKind(candidate) == null) {
        result.add(candidate);
      }
 else       if (candidate instanceof ReferenceChange && ((ReferenceChange)candidate).getReference().isContainment()) {
        prune.add(comparison.getMatch(((ReferenceChange)candidate).getValue()));
      }
    }
  }
  for (  Match submatch : match.getSubmatches()) {
    if (!prune.contains(submatch)) {
      result.addAll(getAllContainedDifferences(comparison,submatch));
    }
  }
  return result;
}
Program: 93611
Project: 93611
Buggy source:
@Override public Boolean defaultCase(EObject object){
  return Boolean.FALSE;
}

Fixed version (ground truth):
@Override public EObject defaultCase(EObject object){
  return null;
}
Program: 93612
Project: 93612
Buggy source:
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.provider.ForwardingItemProvider#getChildren(java.lang.Object)
 */
@Override public Collection<?> getChildren(Object object){
  final Collection<Object> ret=new ArrayList<Object>();
  Match match=null;
  if (isCandidateToAddChildren(object)) {
    DiagramDiff diagramDiff=(DiagramDiff)object;
    EObject view=diagramDiff.getView();
    Comparison comparison=diagramDiff.getMatch().getComparison();
    match=comparison.getMatch(view);
    ret.addAll(match.getSubmatches());
    ITreeItemContentProvider contentProvider=(ITreeItemContentProvider)getRootAdapterFactory().adapt(match,ITreeItemContentProvider.class);
    if (contentProvider != null) {
      ret.addAll(contentProvider.getChildren(match));
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see org.eclipse.emf.compare.provider.ForwardingItemProvider#getChildren(java.lang.Object)
 */
@Override public Collection<?> getChildren(Object object){
  final Collection<Object> ret=new ArrayList<Object>();
  Match match=null;
  if (isCandidateToAddChildren(object)) {
    DiagramDiff diagramDiff=(DiagramDiff)object;
    EObject view=diagramDiff.getView();
    Comparison comparison=diagramDiff.getMatch().getComparison();
    match=comparison.getMatch(view);
    if (match != null) {
      ret.addAll(match.getSubmatches());
      ITreeItemContentProvider contentProvider=(ITreeItemContentProvider)getRootAdapterFactory().adapt(match,ITreeItemContentProvider.class);
      if (contentProvider != null) {
        ret.addAll(contentProvider.getChildren(match));
      }
    }
  }
  return ret;
}
Program: 93613
Project: 93613
Buggy source:
public boolean apply(EObject input){
  boolean ret=false;
  if (input instanceof Diff) {
    final Diff diff=(Diff)input;
    final Conflict conflict=diff.getConflict();
    if (conflict == null) {
      final EObject grandParent=diff.getMatch().eContainer();
      if (grandParent instanceof Match) {
        ImmutableSet<EObject> containementDifferenceValues=MatchItemProviderSpec.containmentReferencesValues((Match)grandParent);
        if (MatchItemProviderSpec.matchOfContainmentDiff(containementDifferenceValues).apply(diff.getMatch())) {
          ret=true;
        }
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
public boolean apply(EObject input){
  boolean ret=false;
  if (input instanceof Diff && !(input instanceof ResourceAttachmentChange)) {
    final Diff diff=(Diff)input;
    final Conflict conflict=diff.getConflict();
    if (conflict == null) {
      final EObject grandParent=diff.getMatch().eContainer();
      if (grandParent instanceof Match) {
        ImmutableSet<EObject> containementDifferenceValues=MatchItemProviderSpec.containmentReferencesValues((Match)grandParent);
        if (MatchItemProviderSpec.matchOfContainmentDiff(containementDifferenceValues).apply(diff.getMatch())) {
          ret=true;
        }
      }
    }
  }
  return ret;
}
Program: 93614
Project: 93614
Buggy source:
/** 
 * Create all of our filtering actions into the given menu.
 * @param scope The scope on which the filters will be applied.
 * @param comparison The comparison on which the filters will be applied.
 */
public void createActions(IComparisonScope scope,Comparison comparison){
  IDifferenceFilter.Registry registry=EMFCompareRCPUIPlugin.getDefault().getFilterActionRegistry();
  for (  IDifferenceFilter filterProvider : registry.getFilters(scope,comparison)) {
    FilterAction action=new FilterAction(filterProvider.getLabel(),structureMergeViewerFilter,filterProvider);
    if (filterProvider.defaultSelected()) {
      action.setChecked(true);
      action.run();
    }
    menuManager.add(action);
  }
}

Fixed version (ground truth):
/** 
 * Create all of our filtering actions into the given menu.
 * @param scope The scope on which the filters will be applied.
 * @param comparison The comparison on which the filters will be applied.
 */
public void createActions(IComparisonScope scope,Comparison comparison){
  menuManager.removeAll();
  IDifferenceFilter.Registry registry=EMFCompareRCPUIPlugin.getDefault().getFilterActionRegistry();
  for (  IDifferenceFilter filterProvider : registry.getFilters(scope,comparison)) {
    FilterAction action=new FilterAction(filterProvider.getLabel(),structureMergeViewerFilter,filterProvider);
    if (filterProvider.defaultSelected()) {
      action.setChecked(true);
      action.run();
    }
    menuManager.add(action);
  }
}
Program: 93615
Project: 93615
Buggy source:
/** 
 * Create the grouping action in the given menu.
 * @param scope The scope on which the groups will be applied.
 * @param comparison The comparison which differences are to be split into groups.
 */
public void createActions(IComparisonScope scope,Comparison comparison){
  final IAction defaultAction=new GroupAction(defaultGroupProvider.getLabel(),structureMergeViewerGrouper,defaultGroupProvider);
  defaultAction.setChecked(true);
  menuManager.add(defaultAction);
  IDifferenceGroupProvider.Registry registry=EMFCompareRCPUIPlugin.getDefault().getDifferenceGroupProviderRegistry();
  boolean alreadyChecked=false;
  for (  IDifferenceGroupProvider dgp : registry.getGroupProviders(scope,comparison)) {
    GroupAction action=new GroupAction(dgp.getLabel(),structureMergeViewerGrouper,dgp);
    menuManager.add(action);
    if (dgp.defaultSelected() && !alreadyChecked) {
      defaultAction.setChecked(false);
      action.setChecked(true);
      alreadyChecked=true;
      action.run();
    }
  }
}

Fixed version (ground truth):
/** 
 * Create the grouping action in the given menu.
 * @param scope The scope on which the groups will be applied.
 * @param comparison The comparison which differences are to be split into groups.
 */
public void createActions(IComparisonScope scope,Comparison comparison){
  menuManager.removeAll();
  final IAction defaultAction=new GroupAction(defaultGroupProvider.getLabel(),structureMergeViewerGrouper,defaultGroupProvider);
  defaultAction.setChecked(true);
  menuManager.add(defaultAction);
  IDifferenceGroupProvider.Registry registry=EMFCompareRCPUIPlugin.getDefault().getDifferenceGroupProviderRegistry();
  boolean alreadyChecked=false;
  for (  IDifferenceGroupProvider dgp : registry.getGroupProviders(scope,comparison)) {
    GroupAction action=new GroupAction(dgp.getLabel(),structureMergeViewerGrouper,dgp);
    menuManager.add(action);
    if (dgp.defaultSelected() && !alreadyChecked) {
      defaultAction.setChecked(false);
      action.setChecked(true);
      alreadyChecked=true;
      action.run();
    }
  }
}
Program: 93616
Project: 93616
Buggy source:
protected int findInsertionIndex(Diff diff,boolean rightToLeft){
  final Match valueMatch=diff.getMatch();
  final Comparison comparison=valueMatch.getComparison();
  final EObject expectedValue;
  if (valueMatch.getLeft() != null) {
    expectedValue=valueMatch.getLeft();
  }
 else {
    expectedValue=valueMatch.getRight();
  }
  final Resource initialResource;
  final Resource expectedResource;
  if (rightToLeft) {
    initialResource=getResource(MergeViewerSide.RIGHT);
    expectedResource=getResource(MergeViewerSide.LEFT);
  }
 else {
    initialResource=getResource(MergeViewerSide.LEFT);
    expectedResource=getResource(MergeViewerSide.RIGHT);
  }
  final List<EObject> sourceList=initialResource.getContents();
  final List<EObject> targetList=expectedResource.getContents();
  return DiffUtil.findInsertionIndex(comparison,sourceList,targetList,expectedValue);
}

Fixed version (ground truth):
protected int findInsertionIndex(Diff diff,boolean rightToLeft){
  final Match valueMatch=diff.getMatch();
  final Comparison comparison=valueMatch.getComparison();
  final EObject expectedValue;
  if (valueMatch.getLeft() != null) {
    expectedValue=valueMatch.getLeft();
  }
 else {
    expectedValue=valueMatch.getRight();
  }
  final Resource initialResource;
  final Resource expectedResource;
  if (rightToLeft) {
    initialResource=getResource(MergeViewerSide.RIGHT);
    expectedResource=getResource(MergeViewerSide.LEFT);
  }
 else {
    initialResource=getResource(MergeViewerSide.LEFT);
    expectedResource=getResource(MergeViewerSide.RIGHT);
  }
  if (expectedResource != null) {
    final List<EObject> sourceList=initialResource.getContents();
    final List<EObject> targetList=expectedResource.getContents();
    return DiffUtil.findInsertionIndex(comparison,sourceList,targetList,expectedValue);
  }
 else {
    return 0;
  }
}
Program: 93617
Project: 93617
Buggy source:
/** 
 * Create all of our filtering actions into the given menu.
 * @param scope The scope on which the filters will be applied.
 * @param comparison The comparison on which the filters will be applied.
 */
public void createActions(IComparisonScope scope,Comparison comparison){
  menuManager.removeAll();
  IDifferenceFilter.Registry registry=EMFCompareRCPUIPlugin.getDefault().getFilterActionRegistry();
  for (  IDifferenceFilter filterProvider : registry.getFilters(scope,comparison)) {
    FilterAction action=new FilterAction(filterProvider.getLabel(),structureMergeViewerFilter,filterProvider);
    if (filterProvider.defaultSelected()) {
      action.setChecked(true);
      action.run();
    }
    menuManager.add(action);
  }
}

Fixed version (ground truth):
/** 
 * Create all of our filtering actions into the given menu.
 * @param scope The scope on which the filters will be applied.
 * @param comparison The comparison on which the filters will be applied.
 */
public void createActions(IComparisonScope scope,Comparison comparison){
  if (menuManager.isEmpty()) {
    IDifferenceFilter.Registry registry=EMFCompareRCPUIPlugin.getDefault().getFilterActionRegistry();
    for (    IDifferenceFilter filterProvider : registry.getFilters(scope,comparison)) {
      FilterAction action=new FilterAction(filterProvider.getLabel(),structureMergeViewerFilter,filterProvider);
      if (filterProvider.defaultSelected()) {
        action.setChecked(true);
        action.run();
      }
      menuManager.add(action);
    }
  }
}
Program: 93618
Project: 93618
Buggy source:
/** 
 * Create the grouping action in the given menu.
 * @param scope The scope on which the groups will be applied.
 * @param comparison The comparison which differences are to be split into groups.
 */
public void createActions(IComparisonScope scope,Comparison comparison){
  menuManager.removeAll();
  final IAction defaultAction=new GroupAction(defaultGroupProvider.getLabel(),structureMergeViewerGrouper,defaultGroupProvider);
  defaultAction.setChecked(true);
  menuManager.add(defaultAction);
  IDifferenceGroupProvider.Registry registry=EMFCompareRCPUIPlugin.getDefault().getDifferenceGroupProviderRegistry();
  boolean alreadyChecked=false;
  for (  IDifferenceGroupProvider dgp : registry.getGroupProviders(scope,comparison)) {
    GroupAction action=new GroupAction(dgp.getLabel(),structureMergeViewerGrouper,dgp);
    menuManager.add(action);
    if (dgp.defaultSelected() && !alreadyChecked) {
      defaultAction.setChecked(false);
      action.setChecked(true);
      alreadyChecked=true;
      action.run();
    }
  }
}

Fixed version (ground truth):
/** 
 * Create the grouping action in the given menu.
 * @param scope The scope on which the groups will be applied.
 * @param comparison The comparison which differences are to be split into groups.
 */
public void createActions(IComparisonScope scope,Comparison comparison){
  if (menuManager.isEmpty()) {
    final IAction defaultAction=new GroupAction(defaultGroupProvider.getLabel(),structureMergeViewerGrouper,defaultGroupProvider);
    defaultAction.setChecked(true);
    menuManager.add(defaultAction);
    IDifferenceGroupProvider.Registry registry=EMFCompareRCPUIPlugin.getDefault().getDifferenceGroupProviderRegistry();
    boolean alreadyChecked=false;
    for (    IDifferenceGroupProvider dgp : registry.getGroupProviders(scope,comparison)) {
      GroupAction action=new GroupAction(dgp.getLabel(),structureMergeViewerGrouper,dgp);
      menuManager.add(action);
      if (dgp.defaultSelected() && !alreadyChecked) {
        defaultAction.setChecked(false);
        action.setChecked(true);
        alreadyChecked=true;
        action.run();
      }
    }
  }
}
Program: 93619
Project: 93619
Buggy source:
public boolean apply(EObject input){
  boolean ret=false;
  if (input instanceof Diff) {
    final Diff diff=(Diff)input;
    final Conflict conflict=diff.getConflict();
    if (conflict == null) {
      final EObject grandParent=diff.getMatch().eContainer();
      if (grandParent instanceof Match) {
        ImmutableSet<EObject> containementDifferenceValues=MatchItemProviderSpec.containmentReferencesValues((Match)grandParent);
        if (MatchItemProviderSpec.matchOfContainmentDiff(containementDifferenceValues).apply(diff.getMatch())) {
          ret=true;
        }
      }
    }
  }
  return ret;
}

Fixed version (ground truth):
public boolean apply(EObject input){
  boolean ret=false;
  if (input instanceof Diff && !(input instanceof ResourceAttachmentChange)) {
    final Diff diff=(Diff)input;
    final Conflict conflict=diff.getConflict();
    if (conflict == null) {
      final EObject grandParent=diff.getMatch().eContainer();
      if (grandParent instanceof Match) {
        ImmutableSet<EObject> containementDifferenceValues=MatchItemProviderSpec.containmentReferencesValues((Match)grandParent);
        if (MatchItemProviderSpec.matchOfContainmentDiff(containementDifferenceValues).apply(diff.getMatch())) {
          ret=true;
        }
      }
    }
  }
  return ret;
}