Program: 12113
Project: 12113
Buggy source:
private SingleVariableDeclaration addParameterToMovedMethod(MethodDeclaration newMethodDeclaration,IVariableBinding variableBinding,ASTRewrite targetRewriter){
  AST ast=newMethodDeclaration.getAST();
  SingleVariableDeclaration parameter=ast.newSingleVariableDeclaration();
  ITypeBinding typeBinding=variableBinding.getType();
  Type fieldType=null;
  if (typeBinding.isClass() || typeBinding.isInterface()) {
    fieldType=ast.newSimpleType(ast.newSimpleName(typeBinding.getName()));
  }
 else   if (typeBinding.isPrimitive()) {
    String primitiveType=typeBinding.getName();
    if (primitiveType.equals("String_Node_Str"))     fieldType=ast.newPrimitiveType(PrimitiveType.INT);
 else     if (primitiveType.equals("String_Node_Str"))     fieldType=ast.newPrimitiveType(PrimitiveType.DOUBLE);
 else     if (primitiveType.equals("String_Node_Str"))     fieldType=ast.newPrimitiveType(PrimitiveType.BYTE);
 else     if (primitiveType.equals("String_Node_Str"))     fieldType=ast.newPrimitiveType(PrimitiveType.SHORT);
 else     if (primitiveType.equals("String_Node_Str"))     fieldType=ast.newPrimitiveType(PrimitiveType.CHAR);
 else     if (primitiveType.equals("String_Node_Str"))     fieldType=ast.newPrimitiveType(PrimitiveType.LONG);
 else     if (primitiveType.equals("String_Node_Str"))     fieldType=ast.newPrimitiveType(PrimitiveType.FLOAT);
 else     if (primitiveType.equals("String_Node_Str"))     fieldType=ast.newPrimitiveType(PrimitiveType.BOOLEAN);
  }
 else   if (typeBinding.isArray()) {
    ITypeBinding elementTypeBinding=typeBinding.getElementType();
    Type elementType=ast.newSimpleType(ast.newSimpleName(elementTypeBinding.getName()));
    fieldType=ast.newArrayType(elementType,typeBinding.getDimensions());
  }
 else   if (typeBinding.isParameterizedType()) {
    fieldType=createParameterizedType(ast,typeBinding,targetRewriter);
  }
  targetRewriter.set(parameter,SingleVariableDeclaration.TYPE_PROPERTY,fieldType,null);
  targetRewriter.set(parameter,SingleVariableDeclaration.NAME_PROPERTY,ast.newSimpleName(variableBinding.getName()),null);
  ListRewrite parametersRewrite=targetRewriter.getListRewrite(newMethodDeclaration,MethodDeclaration.PARAMETERS_PROPERTY);
  parametersRewrite.insertLast(parameter,null);
  Set<ITypeBinding> typeBindings=new LinkedHashSet<ITypeBinding>();
  typeBindings.add(variableBinding.getType());
  getSimpleTypeBindings(typeBindings,requiredImportDeclarationsInExtractedClass);
  return parameter;
}

Fixed version (ground truth):
private SingleVariableDeclaration addParameterToMovedMethod(MethodDeclaration newMethodDeclaration,IVariableBinding variableBinding,ASTRewrite targetRewriter){
  AST ast=newMethodDeclaration.getAST();
  SingleVariableDeclaration parameter=ast.newSingleVariableDeclaration();
  ITypeBinding typeBinding=variableBinding.getType();
  Type fieldType=generateTypeFromTypeBinding(typeBinding,ast,targetRewriter);
  targetRewriter.set(parameter,SingleVariableDeclaration.TYPE_PROPERTY,fieldType,null);
  targetRewriter.set(parameter,SingleVariableDeclaration.NAME_PROPERTY,ast.newSimpleName(variableBinding.getName()),null);
  ListRewrite parametersRewrite=targetRewriter.getListRewrite(newMethodDeclaration,MethodDeclaration.PARAMETERS_PROPERTY);
  parametersRewrite.insertLast(parameter,null);
  Set<ITypeBinding> typeBindings=new LinkedHashSet<ITypeBinding>();
  typeBindings.add(variableBinding.getType());
  getSimpleTypeBindings(typeBindings,requiredImportDeclarationsInExtractedClass);
  return parameter;
}