|
From: Rod J. <rod...@in...> - 2004-08-07 18:40:35
|
As Colin surmises, this is the intended behaviour (first match found). It could possibly be changed if people object, but I think that style of overloading is really the problem. R ----- Original Message ----- From: "Rob Harrop" <ro...@ca...> To: <spr...@li...> Sent: Thursday, August 05, 2004 3:54 PM Subject: Re: [Springframework-developer] Method Replacement > I agree about not using compatible types for overloading - this is > actually an example I am writing for some one to explain how method > replacement works and I came across this behavior and wondered if it is > desirable. > > Rob > > Colin Sampaleanu wrote: > > > Rob Harrop wrote: > > > >> All, > >> > >> I am noticing some strange behavior when using method replacement. > >> > >> I have a bean that has two methods: foo(String) and foo(Object). My > >> method replacer will only replace foo(String) and in my configuration > >> I specify: > >> > >> <replaced-method name="fooBean" replacer="methodReplacer"> > >> <arg-type>String</arg-type> > >> </replaced-method> > >> > >> Yet the method replacer is getting invoked whenever I invoke > >> foo(Object) is this correct or is this a bug? > >> > >> rob > > > > > > Rod can give a qualified answer, but I think that this is probably > > happening due to the way that resolution is happening, where the > > arg-type will match any target method that can take that arg type. In > > general, it's not a great practice in your classes to overload methods > > such that one method takes a superclass of another... > > > > Colin > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by OSTG. Have you noticed the changes on > > Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, > > one more big change to announce. We are now OSTG- Open Source Technology > > Group. Come see the changes on the new OSTG site. www.ostg.com > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by OSTG. Have you noticed the changes on > Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, > one more big change to announce. We are now OSTG- Open Source Technology > Group. Come see the changes on the new OSTG site. www.ostg.com > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer |