Program: 93599
Project: 93599
Buggy source:
/** 
 * It creates a new phantom from the given difference, view and figure.
 * @param diff The related difference used as index for the main phantom.
 * @param referenceView The reference view as base for creation of the phantom.
 * @param referenceFigure The reference figure as base for creation of the phantom.
 * @param side The side where the phantom has to be created.
 * @return The phantom or null if the target layer is not found.
 */
private Phantom createPhantom(Diff diff,View referenceView,IFigure referenceFigure,MergeViewerSide side){
  IFigure targetLayer=getLayer(referenceView,side);
  if (targetLayer != null) {
    MergeViewerSide referenceSide=getSide(referenceView);
    Rectangle rect=referenceFigure.getBounds().getCopy();
    IFigure referenceLayer=getLayer(referenceView,referenceSide);
    translateCoordinates(referenceFigure,referenceLayer,rect);
    DecoratorFigure ghost=null;
    Phantom phantom=new Phantom(targetLayer,side,referenceView,referenceFigure,diff);
    if (isNodeList(referenceView)) {
      Diff refiningDiff=Iterators.find(diff.getRefinedBy().iterator(),and(valueIs(referenceView),onFeature(NotationPackage.Literals.VIEW__PERSISTED_CHILDREN.getName())));
      int index=DiffUtil.findInsertionIndex(getComparison(),refiningDiff,side == MergeViewerSide.LEFT);
      IFigure referenceParentFigure=referenceFigure.getParent();
      Rectangle referenceParentBounds=referenceParentFigure.getBounds().getCopy();
      translateCoordinates(referenceParentFigure,referenceLayer,referenceParentBounds);
      View parentView=(View)getMatchView(referenceView.eContainer(),side);
      if (parentView != null) {
        int nbElements=getVisibleViews(parentView).size();
        if (index > nbElements) {
          index=nbElements;
        }
      }
      int pos=rect.height * index + referenceParentBounds.y + 1;
      Map<String,Object> parameters=new HashMap<String,Object>();
      parameters.put(NodeListFigure.PARAM_Y_POS,Integer.valueOf(pos));
      ghost=new NodeListFigure(diff,isThreeWay(),getCompareColor(),referenceFigure,rect,true,parameters);
    }
 else     if (referenceView instanceof Edge) {
      if (hasAnExtremityChange((Edge)referenceView,side)) {
        EditPart edgeEditPart=createEdgeEditPart((Edge)referenceView,referenceSide,side);
        if (edgeEditPart instanceof GraphicalEditPart) {
          phantom.setEditPart(edgeEditPart);
          IFigure fig=((GraphicalEditPart)edgeEditPart).getFigure();
          fig.getChildren().clear();
          ghost=new DecoratorFigure(diff,isThreeWay(),getCompareColor(),referenceFigure,fig,true);
        }
      }
 else {
        if (referenceFigure instanceof PolylineConnection) {
          ghost=new EdgeFigure(diff,isThreeWay(),getCompareColor(),referenceFigure,rect,true);
        }
      }
    }
    if (ghost == null) {
      ghost=new NodeFigure(diff,isThreeWay(),getCompareColor(),referenceFigure,rect,true);
    }
    phantom.setDecoratorFigure(ghost);
    translateWhenInsideContainerChange(phantom);
    return phantom;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * It creates a new phantom from the given difference, view and figure.
 * @param diff The related difference used as index for the main phantom.
 * @param referenceView The reference view as base for creation of the phantom.
 * @param referenceFigure The reference figure as base for creation of the phantom.
 * @param side The side where the phantom has to be created.
 * @return The phantom or null if the target layer is not found.
 */
private Phantom createPhantom(Diff diff,View referenceView,IFigure referenceFigure,MergeViewerSide side){
  IFigure targetLayer=getLayer(referenceView,side);
  if (targetLayer != null) {
    MergeViewerSide referenceSide=getSide(referenceView);
    Rectangle rect=referenceFigure.getBounds().getCopy();
    IFigure referenceLayer=getLayer(referenceView,referenceSide);
    translateCoordinates(referenceFigure,referenceLayer,rect);
    DecoratorFigure ghost=null;
    Phantom phantom=new Phantom(targetLayer,side,referenceView,referenceFigure,diff);
    if (isNodeList(referenceView)) {
      int index=getIndex(diff,referenceView,side);
      IFigure referenceParentFigure=referenceFigure.getParent();
      Rectangle referenceParentBounds=referenceParentFigure.getBounds().getCopy();
      translateCoordinates(referenceParentFigure,referenceLayer,referenceParentBounds);
      View parentView=(View)getMatchView(referenceView.eContainer(),side);
      if (parentView != null) {
        int nbElements=getVisibleViews(parentView).size();
        if (index > nbElements) {
          index=nbElements;
        }
      }
      int pos=rect.height * index + referenceParentBounds.y + 1;
      Map<String,Object> parameters=new HashMap<String,Object>();
      parameters.put(NodeListFigure.PARAM_Y_POS,Integer.valueOf(pos));
      ghost=new NodeListFigure(diff,isThreeWay(),getCompareColor(),referenceFigure,rect,true,parameters);
    }
 else     if (referenceView instanceof Edge) {
      if (hasAnExtremityChange((Edge)referenceView,side)) {
        EditPart edgeEditPart=createEdgeEditPart((Edge)referenceView,referenceSide,side);
        if (edgeEditPart instanceof GraphicalEditPart) {
          phantom.setEditPart(edgeEditPart);
          IFigure fig=((GraphicalEditPart)edgeEditPart).getFigure();
          fig.getChildren().clear();
          ghost=new DecoratorFigure(diff,isThreeWay(),getCompareColor(),referenceFigure,fig,true);
        }
      }
 else {
        if (referenceFigure instanceof PolylineConnection) {
          ghost=new EdgeFigure(diff,isThreeWay(),getCompareColor(),referenceFigure,rect,true);
        }
      }
    }
    if (ghost == null) {
      ghost=new NodeFigure(diff,isThreeWay(),getCompareColor(),referenceFigure,rect,true);
    }
    phantom.setDecoratorFigure(ghost);
    translateWhenInsideContainerChange(phantom);
    return phantom;
  }
  return null;
}