Community
Participate
Working Groups
I20080613-2000 Having a method with several parameters of the same type and removing the paramter in the method declaration leads to compile error. Invoking the quick fix to "Remove argument" this could guess which paramters should be removed and not the first one in every case. package A; public class E { void foo() { String foo= ""; String param= ""; String bar= ""; bar(foo, param, bar); <- invoke quick fix "Remove Argument" } private void bar(String foo, /* String param, */ String bar) { } } I wish that the "Remove argument" quick fix could guess that the 2nd paramter should be removed according to the names of the given arguments. If the names do not match (or it's not possible due to binary classes) it should behave as it does at the moment.
Nice to have, but how often does it happen that arguments are matching the parameter names? Is it worth the extra analysis?
At least in the JDT source itself i stumbled across several places where this fits into the picture. One example is the DefaultProblem ctor which is often called where the arguments match the parameter names.
In addition to the name matching mechanism as stated in comment #0 it could be implemented with the types in mind. package A; public class E { void foo() { String foo= ""; int param= 5; boolean bar= true; bar(foo, param, bar); <- invoke quick fix "Remove Argument" } private void bar(String foo, /* int param, */ boolean bar) { } }