Refactor: replace method with another one

I did not find this type of refactoring:

if I had an old method, which is called from a bunch of places, now I
introduced another one with different name, but the same signature (and
hopefully, same functinality). Now I want to change all calls to old method
to calls of the new method.

How can I easily do it?


3 comments
Comment actions Permalink

Stupid me. I can just name the new one as an old one, and then
refactor/rename to a new name if needed. Sorry for this posting.

"Michael Jouravlev" <mikus@mail.ru> wrote in message
news:bb39rr$ji8$1@is.intellij.net...

I did not find this type of refactoring:

>

if I had an old method, which is called from a bunch of places, now I
introduced another one with different name, but the same signature (and
hopefully, same functinality). Now I want to change all calls to old

method

to calls of the new method.

>

How can I easily do it?

>
>


0
Comment actions Permalink

On Wed, 28 May 2003 14:31:37 -0700, Michael Jouravlev wrote:

if I had an old method, which is called from a bunch of places, now I
introduced another one with different name, but the same signature (and
hopefully, same functinality). Now I want to change all calls to old
method to calls of the new method.


Sounds like a "deprecate method under cursor ( adding appropriate javadoc
) create a new method ( posibly with the same, or newer param signiture,
and replace all calls with the new one ).

--
...turn to the light - don't be frightened by the shadows it creates,
...turn to the light - turning away could be a terrible mistake
...dream theater - the great debate


0
Comment actions Permalink

another variant is to

1. extract the method body as new method XXX
2. now the body should contain only a call to XXX, replace it with
whatever you want
3. inline the method
4. rename XXX back to the old name

perhaps too complicated, but think it's safer

HTH,
Dimiter

0

Please sign in to leave a comment.