nus-yam/ex-repair huggingface dataset:
Program: 12137
Project: 12137
Buggy source:
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitor.beginTask("String_Node_Str",systemObject.getClassNumber());
  ListIterator<ClassObject> classIterator=systemObject.getClassListIterator();
  while (classIterator.hasNext()) {
    if (monitor.isCanceled())     throw new OperationCanceledException();
    ClassObject classObject=classIterator.next();
    ListIterator<MethodObject> methodIterator=classObject.getMethodIterator();
    while (methodIterator.hasNext()) {
      MethodObject methodObject=methodIterator.next();
      if (methodObject.getMethodBody() != null) {
        CFG cfg=new CFG(methodObject);
        PDG pdg=new PDG(cfg,classObject.getIFile());
        pdg.setFieldsAccessedInMethod(classObject.getFieldsAccessedInsideMethod(methodObject));
        for (        VariableDeclaration declaration : pdg.getVariableDeclarationsInMethod()) {
          PlainVariable variable=new PlainVariable(declaration);
          PDGSliceUnionCollection sliceUnionCollection=new PDGSliceUnionCollection(pdg,variable);
          for (          PDGSliceUnion sliceUnion : sliceUnionCollection.getSliceUnions()) {
            extractedSlices.add(sliceUnion);
          }
        }
        for (        VariableDeclaration declaration : pdg.getVariableDeclarationsAndAccessedFieldsInMethod()) {
          PlainVariable variable=new PlainVariable(declaration);
          PDGObjectSliceUnionCollection objectSliceUnionCollection=new PDGObjectSliceUnionCollection(pdg,variable);
          for (          PDGObjectSliceUnion objectSliceUnion : objectSliceUnionCollection.getSliceUnions()) {
            extractedObjectSlices.add(objectSliceUnion);
          }
        }
      }
    }
    monitor.worked(1);
  }
  monitor.done();
}

Fixed version (ground truth):
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  monitor.beginTask("String_Node_Str",systemObject.getClassNumber());
  ListIterator<ClassObject> classIterator=systemObject.getClassListIterator();
  while (classIterator.hasNext()) {
    if (monitor.isCanceled())     throw new OperationCanceledException();
    ClassObject classObject=classIterator.next();
    ListIterator<MethodObject> methodIterator=classObject.getMethodIterator();
    while (methodIterator.hasNext()) {
      MethodObject methodObject=methodIterator.next();
      if (methodObject.getMethodBody() != null) {
        CFG cfg=new CFG(methodObject);
        PDG pdg=new PDG(cfg,classObject.getIFile());
        pdg.setFieldsAccessedInMethod(classObject.getFieldsAccessedInsideMethod(methodObject));
        for (        VariableDeclaration declaration : pdg.getVariableDeclarationsInMethod()) {
          PlainVariable variable=new PlainVariable(declaration);
          PDGSliceUnionCollection sliceUnionCollection=new PDGSliceUnionCollection(pdg,variable);
          for (          PDGSliceUnion sliceUnion : sliceUnionCollection.getSliceUnions()) {
            extractedSlices.add(sliceUnion);
          }
        }
      }
    }
    monitor.worked(1);
  }
  monitor.done();
}
Program: 12142
Project: 12142
Buggy source:
public LinkedHashSet<VariableDeclaration> getRecursivelyDefinedFields(MethodDeclaration method,Set<MethodDeclaration> processedMethods){
  LinkedHashSet<VariableDeclaration> definedFields=new LinkedHashSet<VariableDeclaration>();
  definedFields.addAll(definedFieldMap.get(method));
  processedMethods.add(method);
  LinkedHashSet<MethodDeclaration> invokedMethods=methodInvocationMap.get(method);
  if (invokedMethods != null) {
    for (    MethodDeclaration invokedMethod : invokedMethods) {
      if (invokedMethod.getBody() != null && !processedMethods.contains(invokedMethod))       definedFields.addAll(getRecursivelyDefinedFields(invokedMethod,processedMethods));
    }
  }
  return definedFields;
}

Fixed version (ground truth):
public LinkedHashSet<VariableDeclaration> getRecursivelyDefinedFields(MethodDeclaration method,Set<MethodDeclaration> processedMethods){
  LinkedHashSet<VariableDeclaration> definedFields=new LinkedHashSet<VariableDeclaration>();
  definedFields.addAll(definedFieldMap.get(method));
  processedMethods.add(method);
  LinkedHashSet<MethodDeclaration> invokedMethods=methodInvocationMap.get(method);
  if (invokedMethods != null) {
    for (    MethodDeclaration invokedMethod : invokedMethods) {
      if (!processedMethods.contains(invokedMethod)) {
        if (invokedMethod.getBody() != null) {
          if ((invokedMethod.getModifiers() & Modifier.NATIVE) != 0) {
          }
 else {
            definedFields.addAll(getRecursivelyDefinedFields(invokedMethod,processedMethods));
          }
        }
 else {
          LinkedHashSet<MethodDeclaration> overridingMethods=overridingMethodMap.get(invokedMethod);
          processedMethods.add(invokedMethod);
          if (overridingMethods != null) {
            for (            MethodDeclaration overridingMethod : overridingMethods) {
              if ((overridingMethod.getModifiers() & Modifier.NATIVE) != 0) {
              }
 else {
                definedFields.addAll(getRecursivelyDefinedFields(overridingMethod,processedMethods));
              }
            }
          }
        }
      }
    }
  }
  return definedFields;
}
Program: 12143
Project: 12143
Buggy source:
private LibraryClassStorage(){
  this.compilationUnitMap=new HashMap<IClassFile,CompilationUnit>();
  this.unMatchedClassFiles=new LinkedHashSet<IClassFile>();
  this.methodInvocationMap=new HashMap<MethodDeclaration,LinkedHashSet<MethodDeclaration>>();
  this.definedFieldMap=new HashMap<MethodDeclaration,LinkedHashSet<VariableDeclaration>>();
  this.usedFieldMap=new HashMap<MethodDeclaration,LinkedHashSet<VariableDeclaration>>();
}

Fixed version (ground truth):
private LibraryClassStorage(){
  this.compilationUnitMap=new HashMap<IClassFile,CompilationUnit>();
  this.unMatchedClassFiles=new LinkedHashSet<IClassFile>();
  this.methodInvocationMap=new HashMap<MethodDeclaration,LinkedHashSet<MethodDeclaration>>();
  this.definedFieldMap=new HashMap<MethodDeclaration,LinkedHashSet<VariableDeclaration>>();
  this.usedFieldMap=new HashMap<MethodDeclaration,LinkedHashSet<VariableDeclaration>>();
  this.subTypeMap=new HashMap<IType,LinkedHashSet<IType>>();
  this.overridingMethodMap=new HashMap<MethodDeclaration,LinkedHashSet<MethodDeclaration>>();
}
Program: 12144
Project: 12144
Buggy source:
public LinkedHashSet<VariableDeclaration> getRecursivelyUsedFields(MethodDeclaration method,Set<MethodDeclaration> processedMethods){
  LinkedHashSet<VariableDeclaration> usedFields=new LinkedHashSet<VariableDeclaration>();
  usedFields.addAll(usedFieldMap.get(method));
  processedMethods.add(method);
  LinkedHashSet<MethodDeclaration> invokedMethods=methodInvocationMap.get(method);
  if (invokedMethods != null) {
    for (    MethodDeclaration invokedMethod : invokedMethods) {
      if (invokedMethod.getBody() != null && !processedMethods.contains(invokedMethod))       usedFields.addAll(getRecursivelyUsedFields(invokedMethod,processedMethods));
    }
  }
  return usedFields;
}

Fixed version (ground truth):
public LinkedHashSet<VariableDeclaration> getRecursivelyUsedFields(MethodDeclaration method,Set<MethodDeclaration> processedMethods){
  LinkedHashSet<VariableDeclaration> usedFields=new LinkedHashSet<VariableDeclaration>();
  usedFields.addAll(usedFieldMap.get(method));
  processedMethods.add(method);
  LinkedHashSet<MethodDeclaration> invokedMethods=methodInvocationMap.get(method);
  if (invokedMethods != null) {
    for (    MethodDeclaration invokedMethod : invokedMethods) {
      if (!processedMethods.contains(invokedMethod)) {
        if (invokedMethod.getBody() != null) {
          if ((invokedMethod.getModifiers() & Modifier.NATIVE) != 0) {
          }
 else {
            usedFields.addAll(getRecursivelyUsedFields(invokedMethod,processedMethods));
          }
        }
 else {
          LinkedHashSet<MethodDeclaration> overridingMethods=overridingMethodMap.get(invokedMethod);
          processedMethods.add(invokedMethod);
          if (overridingMethods != null) {
            for (            MethodDeclaration overridingMethod : overridingMethods) {
              if ((overridingMethod.getModifiers() & Modifier.NATIVE) != 0) {
              }
 else {
                usedFields.addAll(getRecursivelyUsedFields(overridingMethod,processedMethods));
              }
            }
          }
        }
      }
    }
  }
  return usedFields;
}
Program: 12149
Project: 12149
Buggy source:
public Set<PDGNode> getRemovableNodes(){
  Set<PDGNode> removableNodes=new LinkedHashSet<PDGNode>();
  for (  PDGSlice slice : slices) {
    removableNodes.addAll(slice.getRemovableNodes());
  }
  return removableNodes;
}

Fixed version (ground truth):
public Set<PDGNode> getRemovableNodes(){
  Set<PDGNode> removableNodes=new LinkedHashSet<PDGNode>();
  for (  PDGSlice slice : slices) {
    removableNodes.addAll(slice.getRemovableNodes());
  }
  Set<PDGNode> sliceNodes=getSliceNodes();
  List<PDGNode> sliceNodesInReverseOrder=new ArrayList<PDGNode>(sliceNodes);
  Collections.reverse(sliceNodesInReverseOrder);
  for (  PDGNode sliceNode : sliceNodesInReverseOrder) {
    if (sliceNode.getCFGNode() instanceof CFGBranchConditionalNode) {
      int numberOfControlDependentNodes=0;
      int numberOfRemovableControlDependentNodes=0;
      for (      GraphEdge edge : sliceNode.outgoingEdges) {
        PDGDependence dependence=(PDGDependence)edge;
        if (dependence instanceof PDGControlDependence) {
          PDGNode dstPDGNode=(PDGNode)dependence.dst;
          numberOfControlDependentNodes++;
          if (removableNodes.contains(dstPDGNode))           numberOfRemovableControlDependentNodes++;
        }
      }
      if (numberOfControlDependentNodes == numberOfRemovableControlDependentNodes)       removableNodes.add(sliceNode);
    }
  }
  return removableNodes;
}
Program: 12151
Project: 12151
Buggy source:
public boolean satisfiesRules(){
  if (sliceNodes.size() > 1 && !nodeCritetionIsDeclarationOfVariableCriterion() && !variableCriterionIsReturnedVariableInOriginalMethod() && !containsDuplicateNodeWithStateChangingMethodInvocation())   return true;
  return false;
}

Fixed version (ground truth):
public boolean satisfiesRules(){
  if (!nodeCritetionIsDeclarationOfVariableCriterion() && !variableCriterionIsReturnedVariableInOriginalMethod() && !containsDuplicateNodeWithStateChangingMethodInvocation())   return true;
  return false;
}
Program: 12153
Project: 12153
Buggy source:
private ASTSlice[] getTable(){
  if (selectedPackage != null)   astReader=new ASTReader(selectedPackage);
 else   astReader=new ASTReader(selectedProject);
  SystemObject systemObject=astReader.getSystemObject();
  List<PDGSliceUnion> extractedSliceUnions=new ArrayList<PDGSliceUnion>();
  ListIterator<ClassObject> classIterator=systemObject.getClassListIterator();
  while (classIterator.hasNext()) {
    ClassObject classObject=classIterator.next();
    ListIterator<MethodObject> methodIterator=classObject.getMethodIterator();
    while (methodIterator.hasNext()) {
      MethodObject methodObject=methodIterator.next();
      if (methodObject.getMethodBody() != null) {
        CFG cfg=new CFG(methodObject);
        PDG pdg=new PDG(cfg);
        for (        VariableDeclaration declaration : pdg.getVariableDeclarationsInMethod()) {
          PDGSliceUnionCollection sliceUnionCollection=new PDGSliceUnionCollection(pdg,declaration);
          for (          PDGSliceUnion sliceUnion : sliceUnionCollection.getSliceUnions()) {
            extractedSliceUnions.add(sliceUnion);
          }
        }
      }
    }
  }
  ASTSlice[] table=new ASTSlice[extractedSliceUnions.size()];
  for (int i=0; i < extractedSliceUnions.size(); i++) {
    ASTSlice astSlice=new ASTSlice(extractedSliceUnions.get(i));
    table[i]=astSlice;
  }
  return table;
}

Fixed version (ground truth):
private ASTSlice[] getTable(){
  if (selectedPackage != null)   astReader=new ASTReader(selectedPackage);
 else   astReader=new ASTReader(selectedProject);
  SystemObject systemObject=astReader.getSystemObject();
  List<PDGSliceUnion> extractedSliceUnions=new ArrayList<PDGSliceUnion>();
  ListIterator<ClassObject> classIterator=systemObject.getClassListIterator();
  while (classIterator.hasNext()) {
    ClassObject classObject=classIterator.next();
    ListIterator<MethodObject> methodIterator=classObject.getMethodIterator();
    while (methodIterator.hasNext()) {
      MethodObject methodObject=methodIterator.next();
      if (methodObject.getMethodBody() != null) {
        CFG cfg=new CFG(methodObject);
        PDG pdg=new PDG(cfg);
        for (        VariableDeclaration declaration : pdg.getVariableDeclarationsInMethod()) {
          PDGSliceUnionCollection sliceUnionCollection=new PDGSliceUnionCollection(pdg,declaration);
          for (          PDGSliceUnion sliceUnion : sliceUnionCollection.getSliceUnions()) {
            if (sliceUnion.getSliceNodes().size() > 1)             extractedSliceUnions.add(sliceUnion);
          }
        }
      }
    }
  }
  ASTSlice[] table=new ASTSlice[extractedSliceUnions.size()];
  for (int i=0; i < extractedSliceUnions.size(); i++) {
    ASTSlice astSlice=new ASTSlice(extractedSliceUnions.get(i));
    table[i]=astSlice;
  }
  return table;
}
Program: 12154
Project: 12154
Buggy source:
public Set<PDGSlice> getProgramDependenceSlices(PDGNode sliceNode,LocalVariableInstructionObject sliceVariable){
  Set<PDGSlice> slices=new LinkedHashSet<PDGSlice>();
  Set<BasicBlock> boundaryBlocks=boundaryBlocks(sliceNode);
  for (  BasicBlock boundaryBlock : boundaryBlocks) {
    PDGSlice slice=new PDGSlice(this,boundaryBlock,sliceNode,sliceVariable);
    slices.add(slice);
  }
  return slices;
}

Fixed version (ground truth):
public Set<PDGSlice> getProgramDependenceSlices(PDGNode nodeCriterion){
  Set<PDGSlice> slices=new LinkedHashSet<PDGSlice>();
  Set<LocalVariableInstructionObject> examinedVariables=new LinkedHashSet<LocalVariableInstructionObject>();
  for (  LocalVariableInstructionObject definedVariable : nodeCriterion.definedVariables) {
    if (!examinedVariables.contains(definedVariable)) {
      slices.addAll(getProgramDependenceSlices(nodeCriterion,definedVariable));
      examinedVariables.add(definedVariable);
    }
  }
  for (  LocalVariableInstructionObject usedVariable : nodeCriterion.usedVariables) {
    if (!examinedVariables.contains(usedVariable)) {
      slices.addAll(getProgramDependenceSlices(nodeCriterion,usedVariable));
      examinedVariables.add(usedVariable);
    }
  }
  return slices;
}
Program: 12155
Project: 12155
Buggy source:
private Set<PDGNode> traverseBackward(PDGNode node){
  Set<PDGNode> sliceNodes=new LinkedHashSet<PDGNode>();
  sliceNodes.add(node);
  for (  GraphEdge edge : node.incomingEdges) {
    PDGDependence dependence=(PDGDependence)edge;
    if (edges.contains(dependence)) {
      PDGNode srcPDGNode=(PDGNode)dependence.src;
      sliceNodes.addAll(traverseBackward(srcPDGNode));
    }
  }
  return sliceNodes;
}

Fixed version (ground truth):
private Set<PDGNode> traverseBackward(PDGNode node,Set<PDGNode> visitedNodes){
  Set<PDGNode> sliceNodes=new LinkedHashSet<PDGNode>();
  sliceNodes.add(node);
  visitedNodes.add(node);
  for (  GraphEdge edge : node.incomingEdges) {
    PDGDependence dependence=(PDGDependence)edge;
    if (edges.contains(dependence)) {
      PDGNode srcPDGNode=(PDGNode)dependence.src;
      if (!visitedNodes.contains(srcPDGNode))       sliceNodes.addAll(traverseBackward(srcPDGNode,visitedNodes));
    }
  }
  return sliceNodes;
}
Program: 12156
Project: 12156
Buggy source:
public PDGSlice(PDG pdg,BasicBlock boundaryBlock,PDGNode sliceNode,LocalVariableInstructionObject sliceLocalVariable){
  super();
  Set<PDGNode> regionNodes=pdg.blockBasedRegion(boundaryBlock);
  for (  PDGNode node : regionNodes) {
    nodes.add(node);
  }
  for (  GraphEdge edge : pdg.edges) {
    PDGDependence dependence=(PDGDependence)edge;
    if (nodes.contains(dependence.src) && nodes.contains(dependence.dst))     edges.add(dependence);
  }
  this.sliceNode=sliceNode;
  this.sliceLocalVariable=sliceLocalVariable;
}

Fixed version (ground truth):
public PDGSlice(PDG pdg,BasicBlock boundaryBlock,PDGNode nodeCriterion,LocalVariableInstructionObject localVariableCriterion){
  super();
  this.boundaryBlock=boundaryBlock;
  this.nodeCriterion=nodeCriterion;
  this.localVariableCriterion=localVariableCriterion;
  Set<PDGNode> regionNodes=pdg.blockBasedRegion(boundaryBlock);
  for (  PDGNode node : regionNodes) {
    nodes.add(node);
  }
  for (  GraphEdge edge : pdg.edges) {
    PDGDependence dependence=(PDGDependence)edge;
    if (nodes.contains(dependence.src) && nodes.contains(dependence.dst))     edges.add(dependence);
  }
  this.sliceNodes=new LinkedHashSet<PDGNode>();
  if (nodeCriterion.definesLocalVariable(localVariableCriterion)) {
    sliceNodes.addAll(traverseBackward(nodeCriterion,new LinkedHashSet<PDGNode>()));
  }
 else   if (nodeCriterion.usesLocalVariable(localVariableCriterion)) {
    Set<PDGNode> defNodes=getDefNodes(nodeCriterion,localVariableCriterion);
    for (    PDGNode defNode : defNodes) {
      sliceNodes.addAll(traverseBackward(defNode,new LinkedHashSet<PDGNode>()));
    }
  }
  this.remainingNodes=new LinkedHashSet<PDGNode>();
  for (  GraphNode node : pdg.nodes) {
    PDGNode pdgNode=(PDGNode)node;
    if (!sliceNodes.contains(pdgNode))     remainingNodes.add(pdgNode);
  }
  this.passedParameters=new LinkedHashSet<LocalVariableInstructionObject>();
  for (  GraphEdge edge : pdg.edges) {
    PDGDependence dependence=(PDGDependence)edge;
    if (dependence instanceof PDGDataDependence) {
      PDGDataDependence dataDependence=(PDGDataDependence)dependence;
      PDGNode srcPDGNode=(PDGNode)dataDependence.src;
      PDGNode dstPDGNode=(PDGNode)dataDependence.dst;
      if (remainingNodes.contains(srcPDGNode) && sliceNodes.contains(dstPDGNode))       passedParameters.add(dataDependence.getData());
    }
  }
}
Program: 12157
Project: 12157
Buggy source:
public Set<PDGNode> getSliceNodes(){
  Set<PDGNode> sliceNodes=new LinkedHashSet<PDGNode>();
  if (sliceNode.definesLocalVariable(sliceLocalVariable)) {
    sliceNodes.addAll(traverseBackward(sliceNode));
  }
 else   if (sliceNode.usesLocalVariable(sliceLocalVariable)) {
    Set<PDGNode> defNodes=getDefNodes(sliceNode,sliceLocalVariable);
    for (    PDGNode defNode : defNodes) {
      sliceNodes.addAll(traverseBackward(defNode));
    }
  }
  return sliceNodes;
}

Fixed version (ground truth):
public Set<PDGNode> getSliceNodes(){
  return sliceNodes;
}
Program: 12159
Project: 12159
Buggy source:
public CFG(MethodObject method){
  this.method=method;
  this.unjoinedConditionalNodes=new ArrayList<CFGBranchConditionalNode>();
  MethodBodyObject methodBody=method.getMethodBody();
  if (methodBody != null) {
    CompositeStatementObject composite=methodBody.getCompositeStatement();
    process(new ArrayList<CFGNode>(),composite);
    GraphNode.resetNodeNum();
    this.basicBlockCFG=new BasicBlockCFG(this);
  }
}

Fixed version (ground truth):
public CFG(MethodObject method){
  this.method=method;
  this.unjoinedConditionalNodes=new Stack<List<CFGBranchConditionalNode>>();
  MethodBodyObject methodBody=method.getMethodBody();
  if (methodBody != null) {
    CompositeStatementObject composite=methodBody.getCompositeStatement();
    process(new ArrayList<CFGNode>(),composite);
    GraphNode.resetNodeNum();
    this.basicBlockCFG=new BasicBlockCFG(this);
  }
}
Program: 12160
Project: 12160
Buggy source:
private void createTopDownFlow(List<CFGNode> previousNodes,CFGNode currentNode){
  for (  CFGNode previousNode : previousNodes) {
    Flow flow=new Flow(previousNode,currentNode);
    if (previousNode instanceof CFGBranchNode) {
      if (currentNode.getId() == previousNode.getId() + 1 && !(previousNode.getASTStatement() instanceof DoStatement))       flow.setTrueControlFlow(true);
 else       flow.setFalseControlFlow(true);
    }
    edges.add(flow);
  }
  if (previousNodes.size() > 1) {
    for (    CFGBranchConditionalNode conditionalNode : unjoinedConditionalNodes) {
      conditionalNode.setJoinNode(currentNode);
    }
    unjoinedConditionalNodes.clear();
  }
}

Fixed version (ground truth):
private void createTopDownFlow(List<CFGNode> previousNodes,CFGNode currentNode){
  for (  CFGNode previousNode : previousNodes) {
    Flow flow=new Flow(previousNode,currentNode);
    if (previousNode instanceof CFGBranchNode) {
      if (currentNode.getId() == previousNode.getId() + 1 && !(previousNode.getASTStatement() instanceof DoStatement))       flow.setTrueControlFlow(true);
 else       flow.setFalseControlFlow(true);
    }
    edges.add(flow);
  }
  if (previousNodes.size() > 1) {
    List<CFGBranchConditionalNode> conditionalNodes=unjoinedConditionalNodes.pop();
    for (    CFGBranchConditionalNode conditionalNode : conditionalNodes) {
      conditionalNode.setJoinNode(currentNode);
    }
  }
}
Program: 12163
Project: 12163
Buggy source:
public boolean satisfiesRules(){
  for (  PDGSlice slice : slices) {
    if (!slice.satisfiesRules())     return false;
  }
  if (allNodeCriterionsAreDuplicated())   return false;
  if (getSliceNodes().size() <= nodeCriterions.size())   return false;
  return true;
}

Fixed version (ground truth):
public boolean satisfiesRules(){
  for (  PDGSlice slice : slices) {
    if (!slice.satisfiesRules())     return false;
  }
  if (allNodeCriterionsAreDuplicated() || sliceContainsOnlyOneNodeCriterionAndDeclarationOfVariableCriterion())   return false;
  if (getSliceNodes().size() <= nodeCriterions.size())   return false;
  return true;
}
Program: 12165
Project: 12165
Buggy source:
public Set<PDGSlice> getProgramDependenceSlices(PDGNode nodeCriterion){
  Set<PDGSlice> slices=new LinkedHashSet<PDGSlice>();
  Set<VariableDeclaration> examinedVariables=new LinkedHashSet<VariableDeclaration>();
  for (  VariableDeclaration definedVariable : nodeCriterion.definedVariables) {
    if (!examinedVariables.contains(definedVariable)) {
      slices.addAll(getProgramDependenceSlices(nodeCriterion,definedVariable));
      examinedVariables.add(definedVariable);
    }
  }
  for (  VariableDeclaration usedVariable : nodeCriterion.usedVariables) {
    if (!examinedVariables.contains(usedVariable)) {
      slices.addAll(getProgramDependenceSlices(nodeCriterion,usedVariable));
      examinedVariables.add(usedVariable);
    }
  }
  return slices;
}

Fixed version (ground truth):
public Set<PDGSlice> getProgramDependenceSlices(PDGNode nodeCriterion){
  Set<PDGSlice> slices=new LinkedHashSet<PDGSlice>();
  Set<VariableDeclaration> examinedVariables=new LinkedHashSet<VariableDeclaration>();
  for (  VariableDeclaration definedVariable : nodeCriterion.definedVariables) {
    if (!examinedVariables.contains(definedVariable)) {
      slices.addAll(getProgramDependenceSlices(nodeCriterion,definedVariable));
      examinedVariables.add(definedVariable);
    }
  }
  return slices;
}
Program: 12167
Project: 12167
Buggy source:
private ASTSlice[] getTable(){
  if (selectedPackage != null)   astReader=new ASTReader(selectedPackage);
 else   astReader=new ASTReader(selectedProject);
  SystemObject systemObject=astReader.getSystemObject();
  List<PDGSlice> extractedSlices=new ArrayList<PDGSlice>();
  ListIterator<ClassObject> classIterator=systemObject.getClassListIterator();
  while (classIterator.hasNext()) {
    ClassObject classObject=classIterator.next();
    ListIterator<MethodObject> methodIterator=classObject.getMethodIterator();
    while (methodIterator.hasNext()) {
      MethodObject methodObject=methodIterator.next();
      if (methodObject.getMethodBody() != null) {
        CFG cfg=new CFG(methodObject);
        PDG pdg=new PDG(cfg);
        Set<PDGSlice> pdgSlices=pdg.getAllProgramDependenceSlices();
        for (        PDGSlice pdgSlice : pdgSlices) {
          if (pdgSlice.getSliceNodes().size() > 1)           extractedSlices.add(pdgSlice);
        }
      }
    }
  }
  ASTSlice[] table=new ASTSlice[extractedSlices.size()];
  for (int i=0; i < extractedSlices.size(); i++) {
    ASTSlice astSlice=new ASTSlice(extractedSlices.get(i));
    table[i]=astSlice;
  }
  return table;
}

Fixed version (ground truth):
private ASTSlice[] getTable(){
  if (selectedPackage != null)   astReader=new ASTReader(selectedPackage);
 else   astReader=new ASTReader(selectedProject);
  SystemObject systemObject=astReader.getSystemObject();
  List<PDGSlice> extractedSlices=new ArrayList<PDGSlice>();
  ListIterator<ClassObject> classIterator=systemObject.getClassListIterator();
  while (classIterator.hasNext()) {
    ClassObject classObject=classIterator.next();
    ListIterator<MethodObject> methodIterator=classObject.getMethodIterator();
    while (methodIterator.hasNext()) {
      MethodObject methodObject=methodIterator.next();
      if (methodObject.getMethodBody() != null) {
        CFG cfg=new CFG(methodObject);
        PDG pdg=new PDG(cfg);
        Set<PDGSlice> pdgSlices=pdg.getAllProgramDependenceSlices();
        for (        PDGSlice pdgSlice : pdgSlices) {
          if (pdgSlice.getSliceNodes().size() > 1 && !pdgSlice.nodeCriterionBelongsToDuplicatedNodes() && !pdgSlice.containsDuplicateNodeWithDefUseVariable())           extractedSlices.add(pdgSlice);
        }
      }
    }
  }
  ASTSlice[] table=new ASTSlice[extractedSlices.size()];
  for (int i=0; i < extractedSlices.size(); i++) {
    ASTSlice astSlice=new ASTSlice(extractedSlices.get(i));
    table[i]=astSlice;
  }
  return table;
}
Program: 12169
Project: 12169
Buggy source:
public Set<CFGNode> getImmediatelyNestedNodesInTrueControlFlow(){
  Set<CFGNode> nestedNodes=new LinkedHashSet<CFGNode>();
  AbstractStatement abstractStatement=getStatement();
  if (abstractStatement instanceof CompositeStatementObject) {
    Set<AbstractStatement> nestedStatements=new LinkedHashSet<AbstractStatement>();
    CompositeStatementObject composite=(CompositeStatementObject)abstractStatement;
    List<AbstractStatement> statements=composite.getStatements();
    AbstractStatement trueControlFlowStatement=statements.get(0);
    if (trueControlFlowStatement.getStatement() instanceof Block) {
      CompositeStatementObject blockStatement=(CompositeStatementObject)trueControlFlowStatement;
      nestedStatements.addAll(blockStatement.getStatements());
    }
 else     nestedStatements.add(trueControlFlowStatement);
    List<BasicBlock> nestedBasicBlocks=getNestedBasicBlocks();
    nestedBasicBlocks.add(0,getBasicBlock());
    for (    BasicBlock nestedBlock : nestedBasicBlocks) {
      List<CFGNode> nodes=nestedBlock.getAllNodes();
      for (      CFGNode node : nodes) {
        if (nestedStatements.contains(node.getStatement())) {
          nestedNodes.add(node);
        }
      }
    }
  }
  return nestedNodes;
}

Fixed version (ground truth):
public Set<CFGNode> getImmediatelyNestedNodesInTrueControlFlow(){
  Set<CFGNode> nestedNodes=new LinkedHashSet<CFGNode>();
  AbstractStatement abstractStatement=getStatement();
  if (abstractStatement instanceof CompositeStatementObject) {
    Set<AbstractStatement> nestedStatements=new LinkedHashSet<AbstractStatement>();
    CompositeStatementObject composite=(CompositeStatementObject)abstractStatement;
    List<AbstractStatement> statements=composite.getStatements();
    AbstractStatement trueControlFlowStatement=statements.get(0);
    if (trueControlFlowStatement.getStatement() instanceof Block) {
      CompositeStatementObject blockStatement=(CompositeStatementObject)trueControlFlowStatement;
      for (      AbstractStatement statementInsideBlock : blockStatement.getStatements()) {
        if (statementInsideBlock.getStatement() instanceof TryStatement) {
          CompositeStatementObject tryStatement=(CompositeStatementObject)statementInsideBlock;
          processTryStatement(nestedStatements,tryStatement);
        }
 else         nestedStatements.add(statementInsideBlock);
      }
    }
 else     if (trueControlFlowStatement.getStatement() instanceof TryStatement) {
      CompositeStatementObject tryStatement=(CompositeStatementObject)trueControlFlowStatement;
      processTryStatement(nestedStatements,tryStatement);
    }
 else     nestedStatements.add(trueControlFlowStatement);
    List<BasicBlock> nestedBasicBlocks=getNestedBasicBlocks();
    nestedBasicBlocks.add(0,getBasicBlock());
    for (    BasicBlock nestedBlock : nestedBasicBlocks) {
      List<CFGNode> nodes=nestedBlock.getAllNodes();
      for (      CFGNode node : nodes) {
        if (nestedStatements.contains(node.getStatement())) {
          nestedNodes.add(node);
        }
      }
    }
  }
  return nestedNodes;
}
Program: 12171
Project: 12171
Buggy source:
public boolean satisfiesRules(){
  if (!nodeCritetionIsDeclarationOfVariableCriterion() && !variableCriterionIsReturnedVariableInOriginalMethod() && !nodeCriterionAndDeclarationOfVariableCriterionHaveTheSameControlParent()&& !containsBreakContinueSliceNode()&& !containsDuplicateNodeWithStateChangingMethodInvocation())   return true;
  return false;
}

Fixed version (ground truth):
public boolean satisfiesRules(){
  if (!nodeCritetionIsDeclarationOfVariableCriterion() && !variableCriterionIsReturnedVariableInOriginalMethod() && !containsBreakContinueReturnSliceNode()&& !containsDuplicateNodeWithStateChangingMethodInvocation())   return true;
  return false;
}
Program: 12173
Project: 12173
Buggy source:
public boolean satisfiesRules(){
  for (  PDGSlice slice : slices) {
    if (!slice.satisfiesRules())     return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean satisfiesRules(){
  for (  PDGSlice slice : slices) {
    if (!slice.satisfiesRules())     return false;
  }
  if (allNodeCriterionsAreDuplicated())   return false;
  if (getSliceNodes().size() <= nodeCriterions.size())   return false;
  return true;
}
Program: 12174
Project: 12174
Buggy source:
public PDGSliceUnion(PDG pdg,BasicBlock boundaryBlock,Set<PDGNode> nodeCriterions,VariableDeclaration localVariableCriterion){
  this.slices=new ArrayList<PDGSlice>();
  for (  PDGNode nodeCriterion : nodeCriterions) {
    PDGSlice slice=new PDGSlice(pdg,boundaryBlock,nodeCriterion,localVariableCriterion);
    slices.add(slice);
  }
  this.method=pdg.getMethod();
  this.boundaryBlock=boundaryBlock;
  this.localVariableCriterion=localVariableCriterion;
}

Fixed version (ground truth):
public PDGSliceUnion(PDG pdg,BasicBlock boundaryBlock,Set<PDGNode> nodeCriterions,VariableDeclaration localVariableCriterion){
  this.slices=new ArrayList<PDGSlice>();
  for (  PDGNode nodeCriterion : nodeCriterions) {
    PDGSlice slice=new PDGSlice(pdg,boundaryBlock,nodeCriterion,localVariableCriterion);
    slices.add(slice);
  }
  this.method=pdg.getMethod();
  this.boundaryBlock=boundaryBlock;
  this.nodeCriterions=nodeCriterions;
  this.localVariableCriterion=localVariableCriterion;
}
Program: 12175
Project: 12175
Buggy source:
private ASTSlice[] getTable(){
  if (selectedPackage != null)   astReader=new ASTReader(selectedPackage);
 else   astReader=new ASTReader(selectedProject);
  SystemObject systemObject=astReader.getSystemObject();
  List<PDGSliceUnion> extractedSliceUnions=new ArrayList<PDGSliceUnion>();
  ListIterator<ClassObject> classIterator=systemObject.getClassListIterator();
  while (classIterator.hasNext()) {
    ClassObject classObject=classIterator.next();
    ListIterator<MethodObject> methodIterator=classObject.getMethodIterator();
    while (methodIterator.hasNext()) {
      MethodObject methodObject=methodIterator.next();
      if (methodObject.getMethodBody() != null) {
        CFG cfg=new CFG(methodObject);
        PDG pdg=new PDG(cfg);
        for (        VariableDeclaration declaration : pdg.getVariableDeclarationsInMethod()) {
          PDGSliceUnionCollection sliceUnionCollection=new PDGSliceUnionCollection(pdg,declaration);
          for (          PDGSliceUnion sliceUnion : sliceUnionCollection.getSliceUnions()) {
            if (sliceUnion.getSliceNodes().size() > 1)             extractedSliceUnions.add(sliceUnion);
          }
        }
      }
    }
  }
  ASTSlice[] table=new ASTSlice[extractedSliceUnions.size()];
  for (int i=0; i < extractedSliceUnions.size(); i++) {
    ASTSlice astSlice=new ASTSlice(extractedSliceUnions.get(i));
    table[i]=astSlice;
  }
  return table;
}

Fixed version (ground truth):
private ASTSlice[] getTable(){
  if (selectedPackage != null)   astReader=new ASTReader(selectedPackage);
 else   astReader=new ASTReader(selectedProject);
  SystemObject systemObject=astReader.getSystemObject();
  List<PDGSliceUnion> extractedSliceUnions=new ArrayList<PDGSliceUnion>();
  ListIterator<ClassObject> classIterator=systemObject.getClassListIterator();
  while (classIterator.hasNext()) {
    ClassObject classObject=classIterator.next();
    ListIterator<MethodObject> methodIterator=classObject.getMethodIterator();
    while (methodIterator.hasNext()) {
      MethodObject methodObject=methodIterator.next();
      if (methodObject.getMethodBody() != null) {
        CFG cfg=new CFG(methodObject);
        PDG pdg=new PDG(cfg);
        for (        VariableDeclaration declaration : pdg.getVariableDeclarationsInMethod()) {
          PDGSliceUnionCollection sliceUnionCollection=new PDGSliceUnionCollection(pdg,declaration);
          for (          PDGSliceUnion sliceUnion : sliceUnionCollection.getSliceUnions()) {
            extractedSliceUnions.add(sliceUnion);
          }
        }
      }
    }
  }
  ASTSlice[] table=new ASTSlice[extractedSliceUnions.size()];
  for (int i=0; i < extractedSliceUnions.size(); i++) {
    ASTSlice astSlice=new ASTSlice(extractedSliceUnions.get(i));
    table[i]=astSlice;
  }
  return table;
}
Program: 12185
Project: 12185
Buggy source:
public ReplaceConditionalWithPolymorphism(IFile sourceFile,CompilationUnit sourceCompilationUnit,TypeDeclaration sourceTypeDeclaration,TypeCheckElimination typeCheckElimination){
  this.sourceFile=sourceFile;
  this.sourceCompilationUnit=sourceCompilationUnit;
  this.sourceTypeDeclaration=sourceTypeDeclaration;
  this.typeCheckElimination=typeCheckElimination;
  this.sourceRewriter=ASTRewrite.create(sourceTypeDeclaration.getAST());
  this.undoRefactoring=new UndoRefactoring();
  this.returnedVariable=typeCheckElimination.getTypeCheckMethodReturnedVariable();
  this.requiredImportDeclarationsBasedOnSignature=new LinkedHashSet<ITypeBinding>();
  this.thrownExceptions=typeCheckElimination.getThrownExceptions();
  this.abstractMethodName=typeCheckElimination.getTypeCheckMethodName();
}

Fixed version (ground truth):
public ReplaceConditionalWithPolymorphism(IFile sourceFile,CompilationUnit sourceCompilationUnit,TypeDeclaration sourceTypeDeclaration,TypeCheckElimination typeCheckElimination){
  this.sourceFile=sourceFile;
  this.sourceCompilationUnit=sourceCompilationUnit;
  this.sourceTypeDeclaration=sourceTypeDeclaration;
  this.typeCheckElimination=typeCheckElimination;
  this.sourceRewriter=ASTRewrite.create(sourceTypeDeclaration.getAST());
  this.undoRefactoring=new UndoRefactoring();
  this.returnedVariable=typeCheckElimination.getTypeCheckMethodReturnedVariable();
  this.requiredImportDeclarationsBasedOnSignature=new LinkedHashSet<ITypeBinding>();
  this.thrownExceptions=typeCheckElimination.getThrownExceptions();
  this.abstractMethodName=typeCheckElimination.getTypeCheckMethodName();
  if (typeCheckElimination.getTypeField() != null) {
    this.typeVariable=typeCheckElimination.getTypeField();
  }
 else   if (typeCheckElimination.getTypeLocalVariable() != null) {
    this.typeVariable=typeCheckElimination.getTypeLocalVariable();
  }
}
Program: 12190
Project: 12190
Buggy source:
public List<TypeCheckElimination> generateTypeCheckEliminations(CompleteInheritanceDetection inheritanceDetection){
  List<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
  for (  MethodObject methodObject : methodList) {
    MethodBodyObject methodBodyObject=methodObject.getMethodBody();
    if (methodBodyObject != null) {
      List<TypeCheckElimination> list=methodBodyObject.generateTypeCheckEliminations();
      for (      TypeCheckElimination typeCheckElimination : list) {
        if (!typeCheckElimination.allTypeCheckBranchesAreEmpty()) {
          TypeCheckCodeFragmentAnalyzer analyzer=new TypeCheckCodeFragmentAnalyzer(typeCheckElimination,typeDeclaration,methodObject.getMethodDeclaration(),inheritanceDetection);
          if ((typeCheckElimination.getTypeField() != null || typeCheckElimination.getTypeLocalVariable() != null) && typeCheckElimination.allTypeCheckingsContainStaticFieldOrSubclassType() && typeCheckElimination.isApplicable()) {
            analyzer.processTypeCheckCodeFragmentBranches();
            if (typeCheckElimination.getExistingInheritanceTree() == null)             analyzer.inheritanceHierarchyMatchingWithStaticTypes();
            if (!typeCheckElimination.isTypeCheckMethodStateSetter())             typeCheckEliminations.add(typeCheckElimination);
          }
        }
      }
    }
  }
  return typeCheckEliminations;
}

Fixed version (ground truth):
public List<TypeCheckElimination> generateTypeCheckEliminations(CompleteInheritanceDetection inheritanceDetection){
  List<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
  for (  MethodObject methodObject : methodList) {
    MethodBodyObject methodBodyObject=methodObject.getMethodBody();
    if (methodBodyObject != null) {
      List<TypeCheckElimination> list=methodBodyObject.generateTypeCheckEliminations();
      for (      TypeCheckElimination typeCheckElimination : list) {
        if (!typeCheckElimination.allTypeCheckBranchesAreEmpty()) {
          TypeCheckCodeFragmentAnalyzer analyzer=new TypeCheckCodeFragmentAnalyzer(typeCheckElimination,typeDeclaration,methodObject.getMethodDeclaration(),inheritanceDetection);
          if ((typeCheckElimination.getTypeField() != null || typeCheckElimination.getTypeLocalVariable() != null) && typeCheckElimination.allTypeCheckingsContainStaticFieldOrSubclassType() && typeCheckElimination.isApplicable()) {
            if (typeCheckElimination.getExistingInheritanceTree() == null)             analyzer.inheritanceHierarchyMatchingWithStaticTypes();
            if (!typeCheckElimination.isTypeCheckMethodStateSetter())             typeCheckEliminations.add(typeCheckElimination);
          }
        }
      }
    }
  }
  return typeCheckEliminations;
}
Program: 12200
Project: 12200
Buggy source:
public IfStatementExpressionAnalyzer(Expression completeExpression){
  this.root=new DefaultMutableTreeNode();
  this.completeExpression=completeExpression;
  processExpression(root,completeExpression);
}

Fixed version (ground truth):
public IfStatementExpressionAnalyzer(Expression completeExpression){
  this.root=new DefaultMutableTreeNode();
  this.completeExpression=completeExpression;
  this.typeVariableExpressionMap=new LinkedHashMap<SimpleName,Expression>();
  this.typeVariableStaticFieldMap=new LinkedHashMap<SimpleName,SimpleName>();
  this.typeVariableSubclassMap=new LinkedHashMap<SimpleName,Type>();
  processExpression(root,completeExpression);
}
Program: 12201
Project: 12201
Buggy source:
public TypeCheckCodeFragmentAnalyzer(TypeCheckElimination typeCheckElimination,TypeDeclaration typeDeclaration,MethodDeclaration typeCheckMethod,List<InheritanceTree> inheritanceTreeList){
  this.typeCheckElimination=typeCheckElimination;
  this.typeDeclaration=typeDeclaration;
  this.typeCheckMethod=typeCheckMethod;
  this.fields=typeDeclaration.getFields();
  this.methods=typeDeclaration.getMethods();
  this.inheritanceTreeList=inheritanceTreeList;
  this.typeVariableCounterMap=new LinkedHashMap<SimpleName,Integer>();
  typeCheckElimination.setTypeCheckMethod(typeCheckMethod);
  processTypeCheckCodeFragment();
}

Fixed version (ground truth):
public TypeCheckCodeFragmentAnalyzer(TypeCheckElimination typeCheckElimination,TypeDeclaration typeDeclaration,MethodDeclaration typeCheckMethod,List<InheritanceTree> inheritanceTreeList){
  this.typeCheckElimination=typeCheckElimination;
  this.typeDeclaration=typeDeclaration;
  this.typeCheckMethod=typeCheckMethod;
  this.fields=typeDeclaration.getFields();
  this.methods=typeDeclaration.getMethods();
  this.inheritanceTreeList=inheritanceTreeList;
  this.typeVariableCounterMap=new LinkedHashMap<SimpleName,Integer>();
  this.complexExpressionMap=new LinkedHashMap<Expression,IfStatementExpressionAnalyzer>();
  typeCheckElimination.setTypeCheckMethod(typeCheckMethod);
  processTypeCheckCodeFragment();
}
Program: 12203
Project: 12203
Buggy source:
public List<String> getStaticFieldNames(){
  List<String> staticFieldNames=new ArrayList<String>();
  for (  SimpleName simpleName : staticFieldMap.values()) {
    staticFieldNames.add(simpleName.getIdentifier());
  }
  return staticFieldNames;
}

Fixed version (ground truth):
public List<String> getStaticFieldNames(){
  List<String> staticFieldNames=new ArrayList<String>();
  for (  Expression expression : typeCheckMap.keySet()) {
    SimpleName simpleName=staticFieldMap.get(expression);
    staticFieldNames.add(simpleName.getIdentifier());
  }
  return staticFieldNames;
}
Program: 12204
Project: 12204
Buggy source:
public List<SimpleName> getStaticFields(){
  return new ArrayList<SimpleName>(staticFieldMap.values());
}

Fixed version (ground truth):
public List<SimpleName> getStaticFields(){
  ArrayList<SimpleName> staticFields=new ArrayList<SimpleName>();
  for (  Expression expression : typeCheckMap.keySet()) {
    SimpleName simpleName=staticFieldMap.get(expression);
    staticFields.add(simpleName);
  }
  return staticFields;
}
Program: 12205
Project: 12205
Buggy source:
private void replaceTargetClassVariableNameWithThisExpressionInVariableDeclarationInitializers(MethodDeclaration newMethodDeclaration){
  StatementExtractor extractor=new StatementExtractor();
  List<Statement> variableDeclarations=extractor.getVariableDeclarations(newMethodDeclaration.getBody());
  for (  Statement declaration : variableDeclarations) {
    VariableDeclarationStatement variableDeclaration=(VariableDeclarationStatement)declaration;
    List<VariableDeclarationFragment> fragments=variableDeclaration.fragments();
    for (    VariableDeclarationFragment fragment : fragments) {
      Expression initializer=fragment.getInitializer();
      if (initializer instanceof SimpleName) {
        SimpleName simpleNameInitializer=(SimpleName)initializer;
        if (simpleNameInitializer.getIdentifier().equals(targetClassVariableName)) {
          AST ast=newMethodDeclaration.getAST();
          targetRewriter.set(fragment,VariableDeclarationFragment.INITIALIZER_PROPERTY,ast.newThisExpression(),null);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void replaceTargetClassVariableNameWithThisExpressionInVariableDeclarationInitializers(MethodDeclaration newMethodDeclaration){
  StatementExtractor extractor=new StatementExtractor();
  List<Statement> variableDeclarations=extractor.getVariableDeclarations(newMethodDeclaration.getBody());
  for (  Statement declaration : variableDeclarations) {
    VariableDeclarationStatement variableDeclaration=(VariableDeclarationStatement)declaration;
    List<VariableDeclarationFragment> fragments=variableDeclaration.fragments();
    for (    VariableDeclarationFragment fragment : fragments) {
      Expression initializer=fragment.getInitializer();
      if (initializer instanceof SimpleName) {
        SimpleName simpleNameInitializer=(SimpleName)initializer;
        if (simpleNameInitializer.getIdentifier().equals(targetClassVariableName)) {
          AST ast=newMethodDeclaration.getAST();
          targetRewriter.set(fragment,VariableDeclarationFragment.INITIALIZER_PROPERTY,ast.newThisExpression(),null);
        }
      }
 else       if (initializer instanceof FieldAccess) {
        FieldAccess fieldAccess=(FieldAccess)initializer;
        SimpleName simpleNameInitializer=fieldAccess.getName();
        if (simpleNameInitializer.getIdentifier().equals(targetClassVariableName)) {
          AST ast=newMethodDeclaration.getAST();
          targetRewriter.set(fragment,VariableDeclarationFragment.INITIALIZER_PROPERTY,ast.newThisExpression(),null);
        }
      }
    }
  }
}
Program: 12209
Project: 12209
Buggy source:
private void replaceTargetClassVariableNameWithThisExpressionInAssignments(MethodDeclaration newMethodDeclaration){
  ExpressionExtractor extractor=new ExpressionExtractor();
  List<Expression> assignments=extractor.getAssignments(newMethodDeclaration.getBody());
  for (  Expression expression : assignments) {
    Assignment assignment=(Assignment)expression;
    if (assignment.getLeftHandSide() instanceof SimpleName) {
      SimpleName leftHandSide=(SimpleName)assignment.getLeftHandSide();
      if (leftHandSide.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(assignment,Assignment.LEFT_HAND_SIDE_PROPERTY,ast.newThisExpression(),null);
      }
    }
    if (assignment.getRightHandSide() instanceof SimpleName) {
      SimpleName rightHandSide=(SimpleName)assignment.getRightHandSide();
      if (rightHandSide.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(assignment,Assignment.RIGHT_HAND_SIDE_PROPERTY,ast.newThisExpression(),null);
      }
    }
  }
}

Fixed version (ground truth):
private void replaceTargetClassVariableNameWithThisExpressionInAssignments(MethodDeclaration newMethodDeclaration){
  ExpressionExtractor extractor=new ExpressionExtractor();
  List<Expression> assignments=extractor.getAssignments(newMethodDeclaration.getBody());
  for (  Expression expression : assignments) {
    Assignment assignment=(Assignment)expression;
    if (assignment.getLeftHandSide() instanceof SimpleName) {
      SimpleName leftHandSide=(SimpleName)assignment.getLeftHandSide();
      if (leftHandSide.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(assignment,Assignment.LEFT_HAND_SIDE_PROPERTY,ast.newThisExpression(),null);
      }
    }
 else     if (assignment.getLeftHandSide() instanceof FieldAccess) {
      FieldAccess fieldAccess=(FieldAccess)assignment.getLeftHandSide();
      SimpleName leftHandSide=fieldAccess.getName();
      if (leftHandSide.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(assignment,Assignment.LEFT_HAND_SIDE_PROPERTY,ast.newThisExpression(),null);
      }
    }
    if (assignment.getRightHandSide() instanceof SimpleName) {
      SimpleName rightHandSide=(SimpleName)assignment.getRightHandSide();
      if (rightHandSide.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(assignment,Assignment.RIGHT_HAND_SIDE_PROPERTY,ast.newThisExpression(),null);
      }
    }
 else     if (assignment.getRightHandSide() instanceof FieldAccess) {
      FieldAccess fieldAccess=(FieldAccess)assignment.getRightHandSide();
      SimpleName rightHandSide=fieldAccess.getName();
      if (rightHandSide.getIdentifier().equals(targetClassVariableName)) {
        AST ast=newMethodDeclaration.getAST();
        targetRewriter.set(assignment,Assignment.RIGHT_HAND_SIDE_PROPERTY,ast.newThisExpression(),null);
      }
    }
  }
}