Bug 99328 - [change method signature] support conversion of vararg to simple parameter
Summary: [change method signature] support conversion of vararg to simple parameter
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-10 06:41 EDT by Tobias Widmer CLA
Modified: 2006-06-16 05:20 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Widmer CLA 2005-06-10 06:41:45 EDT
Given a method:

public void foo(String... strings) {

}

the refactoring currently issues an error when trying to change the type of 
the parameter from "String..." to "String". This is a perfectly valid change 
(and also necessary, since removing the vararg param and creating a new simple 
one has not the same semantics at the call sites as converting a vararg to a 
simple parameter).

Since varargs are ordered, all arguments except for the first one should be 
removed at the call sites, if the vararg method is called with zero arguments, 
the default value should be passed, and if the vararg method is called with an 
array argument, and error could be issued.
Comment 1 Markus Keller CLA 2006-06-16 05:20:31 EDT
Would need a warning for each call site where arguments are removed or added. Would also need support for entering a default value as soon as the type is turned from vararg to non-vararg.