Program: 12075
Project: 12075
Buggy source:
private ASTNode processASTNodeWithDifferences(AST ast,ASTRewrite sourceRewriter,ASTNode oldASTNode,List<ASTNodeDifference> differences){
  if (differences.isEmpty()) {
    return oldASTNode;
  }
 else {
    Set<String> parameterBindingKeys=originalPassedParameters.keySet();
    Set<String> declaredLocalVariableBindingKeys=mapper.getDeclaredLocalVariablesInMappedNodes().keySet();
    ASTNode newASTNode=ASTNode.copySubtree(ast,oldASTNode);
    for (    ASTNodeDifference difference : differences) {
      Expression oldExpression=difference.getExpression1().getExpression();
      oldExpression=ASTNodeDifference.getParentExpressionOfMethodNameOrTypeName(oldExpression);
      boolean isCommonParameter=false;
      if (oldExpression instanceof SimpleName) {
        SimpleName oldSimpleName=(SimpleName)oldExpression;
        IBinding binding=oldSimpleName.resolveBinding();
        if (parameterBindingKeys.contains(binding.getKey()) || declaredLocalVariableBindingKeys.contains(binding.getKey()))         isCommonParameter=true;
      }
 else       if (oldExpression instanceof QualifiedName) {
        QualifiedName oldQualifiedName=(QualifiedName)oldExpression;
        SimpleName oldSimpleName=oldQualifiedName.getName();
        IBinding binding=oldSimpleName.resolveBinding();
        if (parameterBindingKeys.contains(binding.getKey()) || declaredLocalVariableBindingKeys.contains(binding.getKey()))         isCommonParameter=true;
      }
      if (!isCommonParameter) {
        if (difference instanceof FieldAccessReplacedWithGetterInvocationDifference) {
          FieldAccessReplacedWithGetterInvocationDifference nodeDifference=(FieldAccessReplacedWithGetterInvocationDifference)difference;
          MethodInvocation newGetterMethodInvocation=generateGetterMethodInvocation(ast,sourceRewriter,nodeDifference);
          if (oldASTNode.equals(oldExpression)) {
            return newGetterMethodInvocation;
          }
 else {
            replaceExpression(sourceRewriter,oldASTNode,newASTNode,oldExpression,newGetterMethodInvocation);
          }
        }
 else         if (difference instanceof FieldAssignmentReplacedWithSetterInvocationDifference) {
          FieldAssignmentReplacedWithSetterInvocationDifference nodeDifference=(FieldAssignmentReplacedWithSetterInvocationDifference)difference;
          MethodInvocation newSetterMethodInvocation=generateSetterMethodInvocation(ast,sourceRewriter,nodeDifference);
          if (oldASTNode.equals(oldExpression)) {
            return newSetterMethodInvocation;
          }
 else {
            replaceExpression(sourceRewriter,oldASTNode,newASTNode,oldExpression,newSetterMethodInvocation);
          }
        }
 else         if (oldExpression.getParent() instanceof Type) {
          Type oldType=(Type)oldExpression.getParent();
          if (difference.containsDifferenceType(DifferenceType.SUBCLASS_TYPE_MISMATCH)) {
            ITypeBinding typeBinding1=difference.getExpression1().getExpression().resolveTypeBinding();
            ITypeBinding typeBinding2=difference.getExpression2().getExpression().resolveTypeBinding();
            ITypeBinding commonSuperTypeBinding=ASTNodeMatcher.commonSuperType(typeBinding1,typeBinding2);
            if (commonSuperTypeBinding != null) {
              Type arg=generateTypeFromTypeBinding(commonSuperTypeBinding,ast,sourceRewriter);
              TypeVisitor oldTypeVisitor=new TypeVisitor();
              oldASTNode.accept(oldTypeVisitor);
              List<Type> oldTypes=oldTypeVisitor.getTypes();
              TypeVisitor newTypeVisitor=new TypeVisitor();
              newASTNode.accept(newTypeVisitor);
              List<Type> newTypes=newTypeVisitor.getTypes();
              int j=0;
              for (              Type type : oldTypes) {
                Type newType=newTypes.get(j);
                if (type.equals(oldType)) {
                  sourceRewriter.replace(newType,arg,null);
                  break;
                }
                j++;
              }
            }
          }
        }
 else {
          Set<VariableDeclaration> fields1=fieldDeclarationsToBePulledUp.get(0);
          BindingSignature bindingSignature1=difference.getBindingSignaturePair().getSignature1();
          boolean expression1IsFieldToBePulledUp=false;
          for (          VariableDeclaration field : fields1) {
            if (bindingSignature1.containsOnlyBinding(field.resolveBinding().getKey())) {
              expression1IsFieldToBePulledUp=true;
              break;
            }
          }
          Set<VariableDeclaration> fields2=fieldDeclarationsToBePulledUp.get(1);
          BindingSignature bindingSignature2=difference.getBindingSignaturePair().getSignature2();
          boolean expression2IsFieldToBePulledUp=false;
          for (          VariableDeclaration field : fields2) {
            if (bindingSignature2.containsOnlyBinding(field.resolveBinding().getKey())) {
              expression2IsFieldToBePulledUp=true;
              break;
            }
          }
          boolean expressionIsFieldToBePulledUp=expression1IsFieldToBePulledUp && expression2IsFieldToBePulledUp;
          if (!expressionIsFieldToBePulledUp) {
            Expression argument=createArgument(ast,difference);
            if (oldASTNode.equals(oldExpression)) {
              return argument;
            }
 else {
              replaceExpression(sourceRewriter,oldASTNode,newASTNode,oldExpression,argument);
            }
          }
        }
      }
    }
    return newASTNode;
  }
}

Fixed version (ground truth):
private ASTNode processASTNodeWithDifferences(AST ast,ASTRewrite sourceRewriter,ASTNode oldASTNode,List<ASTNodeDifference> differences){
  if (differences.isEmpty()) {
    return oldASTNode;
  }
 else {
    Set<VariableBindingKeyPair> parameterBindingKeys=originalPassedParameters.keySet();
    Set<VariableBindingKeyPair> declaredLocalVariableBindingKeys=mapper.getDeclaredLocalVariablesInMappedNodes().keySet();
    ASTNode newASTNode=ASTNode.copySubtree(ast,oldASTNode);
    for (    ASTNodeDifference difference : differences) {
      Expression oldExpression=difference.getExpression1().getExpression();
      oldExpression=ASTNodeDifference.getParentExpressionOfMethodNameOrTypeName(oldExpression);
      Expression oldExpression2=difference.getExpression2().getExpression();
      oldExpression2=ASTNodeDifference.getParentExpressionOfMethodNameOrTypeName(oldExpression2);
      boolean isCommonParameter=false;
      if (oldExpression instanceof SimpleName && oldExpression2 instanceof SimpleName) {
        SimpleName oldSimpleName=(SimpleName)oldExpression;
        SimpleName oldSimpleName2=(SimpleName)oldExpression2;
        IBinding binding=oldSimpleName.resolveBinding();
        IBinding binding2=oldSimpleName2.resolveBinding();
        VariableBindingKeyPair keyPair=new VariableBindingKeyPair(binding.getKey(),binding2.getKey());
        if (parameterBindingKeys.contains(keyPair) || declaredLocalVariableBindingKeys.contains(keyPair))         isCommonParameter=true;
      }
 else       if (oldExpression instanceof QualifiedName && oldExpression2 instanceof QualifiedName) {
        QualifiedName oldQualifiedName=(QualifiedName)oldExpression;
        QualifiedName oldQualifiedName2=(QualifiedName)oldExpression2;
        SimpleName oldSimpleName=oldQualifiedName.getName();
        SimpleName oldSimpleName2=oldQualifiedName2.getName();
        IBinding binding=oldSimpleName.resolveBinding();
        IBinding binding2=oldSimpleName2.resolveBinding();
        VariableBindingKeyPair keyPair=new VariableBindingKeyPair(binding.getKey(),binding2.getKey());
        if (parameterBindingKeys.contains(keyPair) || declaredLocalVariableBindingKeys.contains(keyPair))         isCommonParameter=true;
      }
      if (!isCommonParameter) {
        if (difference instanceof FieldAccessReplacedWithGetterInvocationDifference) {
          FieldAccessReplacedWithGetterInvocationDifference nodeDifference=(FieldAccessReplacedWithGetterInvocationDifference)difference;
          MethodInvocation newGetterMethodInvocation=generateGetterMethodInvocation(ast,sourceRewriter,nodeDifference);
          if (oldASTNode.equals(oldExpression)) {
            return newGetterMethodInvocation;
          }
 else {
            replaceExpression(sourceRewriter,oldASTNode,newASTNode,oldExpression,newGetterMethodInvocation);
          }
        }
 else         if (difference instanceof FieldAssignmentReplacedWithSetterInvocationDifference) {
          FieldAssignmentReplacedWithSetterInvocationDifference nodeDifference=(FieldAssignmentReplacedWithSetterInvocationDifference)difference;
          MethodInvocation newSetterMethodInvocation=generateSetterMethodInvocation(ast,sourceRewriter,nodeDifference);
          if (oldASTNode.equals(oldExpression)) {
            return newSetterMethodInvocation;
          }
 else {
            replaceExpression(sourceRewriter,oldASTNode,newASTNode,oldExpression,newSetterMethodInvocation);
          }
        }
 else         if (oldExpression.getParent() instanceof Type) {
          Type oldType=(Type)oldExpression.getParent();
          if (difference.containsDifferenceType(DifferenceType.SUBCLASS_TYPE_MISMATCH)) {
            ITypeBinding typeBinding1=difference.getExpression1().getExpression().resolveTypeBinding();
            ITypeBinding typeBinding2=difference.getExpression2().getExpression().resolveTypeBinding();
            ITypeBinding commonSuperTypeBinding=ASTNodeMatcher.commonSuperType(typeBinding1,typeBinding2);
            if (commonSuperTypeBinding != null) {
              Type arg=generateTypeFromTypeBinding(commonSuperTypeBinding,ast,sourceRewriter);
              TypeVisitor oldTypeVisitor=new TypeVisitor();
              oldASTNode.accept(oldTypeVisitor);
              List<Type> oldTypes=oldTypeVisitor.getTypes();
              TypeVisitor newTypeVisitor=new TypeVisitor();
              newASTNode.accept(newTypeVisitor);
              List<Type> newTypes=newTypeVisitor.getTypes();
              int j=0;
              for (              Type type : oldTypes) {
                Type newType=newTypes.get(j);
                if (type.equals(oldType)) {
                  sourceRewriter.replace(newType,arg,null);
                  break;
                }
                j++;
              }
            }
          }
        }
 else {
          Set<VariableDeclaration> fields1=fieldDeclarationsToBePulledUp.get(0);
          BindingSignature bindingSignature1=difference.getBindingSignaturePair().getSignature1();
          boolean expression1IsFieldToBePulledUp=false;
          for (          VariableDeclaration field : fields1) {
            if (bindingSignature1.containsOnlyBinding(field.resolveBinding().getKey())) {
              expression1IsFieldToBePulledUp=true;
              break;
            }
          }
          Set<VariableDeclaration> fields2=fieldDeclarationsToBePulledUp.get(1);
          BindingSignature bindingSignature2=difference.getBindingSignaturePair().getSignature2();
          boolean expression2IsFieldToBePulledUp=false;
          for (          VariableDeclaration field : fields2) {
            if (bindingSignature2.containsOnlyBinding(field.resolveBinding().getKey())) {
              expression2IsFieldToBePulledUp=true;
              break;
            }
          }
          boolean expressionIsFieldToBePulledUp=expression1IsFieldToBePulledUp && expression2IsFieldToBePulledUp;
          if (!expressionIsFieldToBePulledUp) {
            Expression argument=createArgument(ast,difference);
            if (oldASTNode.equals(oldExpression)) {
              return argument;
            }
 else {
              replaceExpression(sourceRewriter,oldASTNode,newASTNode,oldExpression,argument);
            }
          }
        }
      }
    }
    return newASTNode;
  }
}