Clan x86

Technical (Development, Security, etc.) => General Programming => Tutorials, References, and Examples => Topic started by: Camel on December 08, 2007, 06:19:40 pm

Title: [Eclipse] Change method signature
Post by: Camel on December 08, 2007, 06:19:40 pm
Today, I realized that I had a fatal flaw in my plugin system: I needed to add a parameter to every event to indicate what the source of the event was.

Crap. There are 27 event methods defined in the interface, and the interface is implemented many times in my codebase. Rewriting this by hand was going to suck, so I started looking for a way to cheat. I found it.

I opened up my interface, right clicked on the first method > refactor > change method signature. A dialog pops up with all of the existing parameters; it allows you to add new fields, and a defualt value. When you click OK, it goes through your entire codebase and changes references to that method, using the default value for new fields.

What I estimated to be a couple of hours of work was compressed in to approximately ten minutes.
Title: Re: [Eclipse] Change method signature
Post by: Newby on February 04, 2008, 07:15:18 pm
Well done. Did you go through and verify by hand afterwards that everything was correct?
Title: Re: [Eclipse] Change method signature
Post by: Camel on February 04, 2008, 09:38:12 pm
I always look at a diff before I commit to SVN.