Bug 99328

Summary: [change method signature] support conversion of vararg to simple parameter
Product: [Eclipse Project] JDT Reporter: Tobias Widmer <tobias_widmer>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

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.