Re: [Clirr-devel] MethodSetCheck: changing argument count
Status: Alpha
Brought to you by:
lkuehne
From: <lak...@t-...> - 2004-07-05 06:14:57
|
Hi Simon, sorry for the late answer. Simon Kitching wrote: >Hi Lars, > >Re the check for "Method argument count changed". > >I suggest it would be better to remove the "heuristic" code in the >"similarity" section which tries to pair up methods which have different >numbers of parameters. > >If this code was removed, then > >old class: > foo(int i); > >new class: > foo(String s, Object o); > >would report > * removed method "foo(int i)" > * added method "foo(String s, Object o)" >rather than > * changed # of arguments in method foo > >Are these two different versions of method Foo *really* "the same method >with different number of arguments"? I think the answer is "sometimes >yes, sometimes no". > >And what do we report if the old version of Foo was overriding an >inherited method, and the new version is not? > >By reporting a method removed + a method added, we may miss an >opportunity to be "clever", but we won't ever report "method changed >argument count" when the user sees the two variants as really being >different methods. > > > I think I implemented that heuristic as a response to a feature request from Stephen Colebourne. >I think this is particularly important when there are a number of >overloaded variants with the same method name. > >One possible compromise is to report "method changed argument count" >only when new arguments have been added to the end of the list of >arguments for the old method version. But frankly even this seems to >introduce more complexity than needed. > >What do you think? > > I agree the algorithm it's not perfect. Not sure if this is reason enough to remove it completely, maybe it's not that difficult to improve it? I'd suggest leaving it in there, release 0.4 and wait for user feedback. Lars |