Program: 12181
Project: 12181
Buggy source:
private void generateSettersForAssignedFields(){
  AST contextAST=sourceTypeDeclaration.getAST();
  Set<VariableDeclarationFragment> assignedFields=new LinkedHashSet<VariableDeclarationFragment>();
  assignedFields.addAll(typeCheckElimination.getAssignedFields());
  assignedFields.addAll(typeCheckElimination.getSuperAssignedFields());
  for (  VariableDeclarationFragment fragment : assignedFields) {
    IMethodBinding setterMethodBinding=null;
    if (typeCheckElimination.getSuperAssignedFields().contains(fragment)) {
      setterMethodBinding=typeCheckElimination.getSetterMethodBindingOfSuperAssignedField(fragment.resolveBinding());
    }
 else {
      setterMethodBinding=findSetterMethodInContext(fragment.resolveBinding());
    }
    if (setterMethodBinding == null) {
      FieldDeclaration fieldDeclaration=(FieldDeclaration)fragment.getParent();
      if (!fragment.equals(typeCheckElimination.getTypeField())) {
        MethodDeclaration newMethodDeclaration=contextAST.newMethodDeclaration();
        sourceRewriter.set(newMethodDeclaration,MethodDeclaration.RETURN_TYPE2_PROPERTY,contextAST.newPrimitiveType(PrimitiveType.VOID),null);
        ListRewrite methodDeclarationModifiersRewrite=sourceRewriter.getListRewrite(newMethodDeclaration,MethodDeclaration.MODIFIERS2_PROPERTY);
        methodDeclarationModifiersRewrite.insertLast(contextAST.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD),null);
        String methodName=fragment.getName().getIdentifier();
        methodName="String_Node_Str" + methodName.substring(0,1).toUpperCase() + methodName.substring(1,methodName.length());
        sourceRewriter.set(newMethodDeclaration,MethodDeclaration.NAME_PROPERTY,contextAST.newSimpleName(methodName),null);
        ListRewrite methodDeclarationParametersRewrite=sourceRewriter.getListRewrite(newMethodDeclaration,MethodDeclaration.PARAMETERS_PROPERTY);
        SingleVariableDeclaration parameter=contextAST.newSingleVariableDeclaration();
        sourceRewriter.set(parameter,SingleVariableDeclaration.TYPE_PROPERTY,fieldDeclaration.getType(),null);
        sourceRewriter.set(parameter,SingleVariableDeclaration.NAME_PROPERTY,fragment.getName(),null);
        methodDeclarationParametersRewrite.insertLast(parameter,null);
        Block methodDeclarationBody=contextAST.newBlock();
        ListRewrite methodDeclarationBodyStatementsRewrite=sourceRewriter.getListRewrite(methodDeclarationBody,Block.STATEMENTS_PROPERTY);
        Assignment assignment=contextAST.newAssignment();
        sourceRewriter.set(assignment,Assignment.RIGHT_HAND_SIDE_PROPERTY,fragment.getName(),null);
        sourceRewriter.set(assignment,Assignment.OPERATOR_PROPERTY,Assignment.Operator.ASSIGN,null);
        FieldAccess fieldAccess=contextAST.newFieldAccess();
        sourceRewriter.set(fieldAccess,FieldAccess.EXPRESSION_PROPERTY,contextAST.newThisExpression(),null);
        sourceRewriter.set(fieldAccess,FieldAccess.NAME_PROPERTY,fragment.getName(),null);
        sourceRewriter.set(assignment,Assignment.LEFT_HAND_SIDE_PROPERTY,fieldAccess,null);
        ExpressionStatement expressionStatement=contextAST.newExpressionStatement(assignment);
        methodDeclarationBodyStatementsRewrite.insertLast(expressionStatement,null);
        sourceRewriter.set(newMethodDeclaration,MethodDeclaration.BODY_PROPERTY,methodDeclarationBody,null);
        ListRewrite contextBodyRewrite=sourceRewriter.getListRewrite(sourceTypeDeclaration,TypeDeclaration.BODY_DECLARATIONS_PROPERTY);
        contextBodyRewrite.insertLast(newMethodDeclaration,null);
      }
    }
  }
}

Fixed version (ground truth):
private void generateSettersForAssignedFields(){
  AST contextAST=sourceTypeDeclaration.getAST();
  Set<VariableDeclarationFragment> assignedFields=new LinkedHashSet<VariableDeclarationFragment>();
  assignedFields.addAll(typeCheckElimination.getAssignedFields());
  assignedFields.addAll(typeCheckElimination.getSuperAssignedFields());
  for (  VariableDeclarationFragment fragment : assignedFields) {
    IMethodBinding setterMethodBinding=null;
    if (typeCheckElimination.getSuperAssignedFields().contains(fragment)) {
      for (      IVariableBinding fieldBinding : typeCheckElimination.getSuperAssignedFieldBindings()) {
        if (fieldBinding.isEqualTo(fragment.resolveBinding())) {
          setterMethodBinding=typeCheckElimination.getSetterMethodBindingOfSuperAssignedField(fieldBinding);
          break;
        }
      }
    }
 else {
      setterMethodBinding=findSetterMethodInContext(fragment.resolveBinding());
    }
    if (setterMethodBinding == null) {
      FieldDeclaration fieldDeclaration=(FieldDeclaration)fragment.getParent();
      if (!fragment.equals(typeCheckElimination.getTypeField())) {
        MethodDeclaration newMethodDeclaration=contextAST.newMethodDeclaration();
        sourceRewriter.set(newMethodDeclaration,MethodDeclaration.RETURN_TYPE2_PROPERTY,contextAST.newPrimitiveType(PrimitiveType.VOID),null);
        ListRewrite methodDeclarationModifiersRewrite=sourceRewriter.getListRewrite(newMethodDeclaration,MethodDeclaration.MODIFIERS2_PROPERTY);
        methodDeclarationModifiersRewrite.insertLast(contextAST.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD),null);
        String methodName=fragment.getName().getIdentifier();
        methodName="String_Node_Str" + methodName.substring(0,1).toUpperCase() + methodName.substring(1,methodName.length());
        sourceRewriter.set(newMethodDeclaration,MethodDeclaration.NAME_PROPERTY,contextAST.newSimpleName(methodName),null);
        ListRewrite methodDeclarationParametersRewrite=sourceRewriter.getListRewrite(newMethodDeclaration,MethodDeclaration.PARAMETERS_PROPERTY);
        SingleVariableDeclaration parameter=contextAST.newSingleVariableDeclaration();
        sourceRewriter.set(parameter,SingleVariableDeclaration.TYPE_PROPERTY,fieldDeclaration.getType(),null);
        sourceRewriter.set(parameter,SingleVariableDeclaration.NAME_PROPERTY,fragment.getName(),null);
        methodDeclarationParametersRewrite.insertLast(parameter,null);
        Block methodDeclarationBody=contextAST.newBlock();
        ListRewrite methodDeclarationBodyStatementsRewrite=sourceRewriter.getListRewrite(methodDeclarationBody,Block.STATEMENTS_PROPERTY);
        Assignment assignment=contextAST.newAssignment();
        sourceRewriter.set(assignment,Assignment.RIGHT_HAND_SIDE_PROPERTY,fragment.getName(),null);
        sourceRewriter.set(assignment,Assignment.OPERATOR_PROPERTY,Assignment.Operator.ASSIGN,null);
        FieldAccess fieldAccess=contextAST.newFieldAccess();
        sourceRewriter.set(fieldAccess,FieldAccess.EXPRESSION_PROPERTY,contextAST.newThisExpression(),null);
        sourceRewriter.set(fieldAccess,FieldAccess.NAME_PROPERTY,fragment.getName(),null);
        sourceRewriter.set(assignment,Assignment.LEFT_HAND_SIDE_PROPERTY,fieldAccess,null);
        ExpressionStatement expressionStatement=contextAST.newExpressionStatement(assignment);
        methodDeclarationBodyStatementsRewrite.insertLast(expressionStatement,null);
        sourceRewriter.set(newMethodDeclaration,MethodDeclaration.BODY_PROPERTY,methodDeclarationBody,null);
        ListRewrite contextBodyRewrite=sourceRewriter.getListRewrite(sourceTypeDeclaration,TypeDeclaration.BODY_DECLARATIONS_PROPERTY);
        contextBodyRewrite.insertLast(newMethodDeclaration,null);
      }
    }
  }
}