Community
Participate
Working Groups
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.
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.