Program: 50108
Project: 50108
Buggy source:
/** 
 * Builds default argument function calls.
 */
private void makeDefaultCalls(IASTFunctionDeclarator func,IBinding funcBinding,TypeDeclaration decl) throws DOMException {
  List<Expression> defaultValues=getDefaultValues(func);
  for (int k=defaultValues.size() - 1; k >= 0; k--) {
    if (defaultValues.get(k) == null)     break;
    MethodDeclaration methodDef=ast.newMethodDeclaration();
    methodDef.setName(ast.newSimpleName(getSimpleName(func.getName())));
    methodDef.setReturnType2(evalReturnType(funcBinding));
    methodDef.modifiers().add(ast.newModifier(ModifierKeyword.PUBLIC_KEYWORD));
    List<SingleVariableDeclaration> list=evalParameters(funcBinding);
    for (int k2=0; k2 < k; k2++)     methodDef.parameters().add(list.get(k2));
    Block funcBlockDef=ast.newBlock();
    MethodInvocation methodInvoc=ast.newMethodInvocation();
    methodInvoc.setName(ast.newSimpleName(getSimpleName(func.getName())));
    List<SimpleName> names=getArgumentNames(funcBinding);
    for (int k3=0; k3 < k; k3++)     methodInvoc.arguments().add(names.get(k3));
    List<Expression> vals=getDefaultValues(func);
    for (int k4=k; k4 < defaultValues.size(); k4++)     methodInvoc.arguments().add(vals.get(k4));
    ReturnStatement ret2=ast.newReturnStatement();
    ret2.setExpression(methodInvoc);
    funcBlockDef.statements().add(ret2);
    methodDef.setBody(funcBlockDef);
    if (decl != null)     decl.bodyDeclarations().add(methodDef);
 else {
      decl=currentDeclarations.get(getQualifiedPart(func.getName()));
      decl.bodyDeclarations().add(methodDef);
    }
  }
}

Fixed version (ground truth):
/** 
 * Builds default argument function calls. For example: int func_with_defaults(int one, int two = 5); would generate: public int func_with_defaults(int one) { return func_with_defaults(one, 5); }
 */
private void makeDefaultCalls(IASTFunctionDeclarator func,IBinding funcBinding,TypeDeclaration decl) throws DOMException {
  List<Expression> defaultValues=getDefaultValues(func);
  for (int k=defaultValues.size() - 1; k >= 0; k--) {
    if (defaultValues.get(k) == null)     break;
    MethodDeclaration methodDef=ast.newMethodDeclaration();
    methodDef.setName(ast.newSimpleName(getSimpleName(func.getName())));
    methodDef.setReturnType2(evalReturnType(funcBinding));
    methodDef.modifiers().add(ast.newModifier(ModifierKeyword.PUBLIC_KEYWORD));
    List<SingleVariableDeclaration> list=evalParameters(funcBinding);
    for (int k2=0; k2 < k; k2++)     methodDef.parameters().add(list.get(k2));
    Block funcBlockDef=ast.newBlock();
    MethodInvocation methodInvoc=ast.newMethodInvocation();
    methodInvoc.setName(ast.newSimpleName(getSimpleName(func.getName())));
    List<SimpleName> names=getArgumentNames(funcBinding);
    for (int k3=0; k3 < k; k3++)     methodInvoc.arguments().add(names.get(k3));
    List<Expression> vals=getDefaultValues(func);
    for (int k4=k; k4 < defaultValues.size(); k4++)     methodInvoc.arguments().add(vals.get(k4));
    if (evalReturnType(funcBinding).toString().equals("String_Node_Str")) {
      funcBlockDef.statements().add(ast.newExpressionStatement(methodInvoc));
    }
 else {
      ReturnStatement ret2=ast.newReturnStatement();
      ret2.setExpression(methodInvoc);
      funcBlockDef.statements().add(ret2);
    }
    methodDef.setBody(funcBlockDef);
    if (decl != null)     decl.bodyDeclarations().add(methodDef);
 else {
      decl=currentDeclarations.get(getQualifiedPart(func.getName()));
      decl.bodyDeclarations().add(methodDef);
    }
  }
}