Right now if you want to replace #old by #new, the method new should be defined in the class of the method containing #old.
However the refactoring will happily perform the following change
callerOfOld
^ a old
into
callerOfOld
^ a new
So there is a misconception between the existence of the method and the fact that the transformation is applied.
The check that a method should be defined in the class is good for rename (rename is using RBReplaceMessageSendTransformation) because during renaming a new method with the new name is defined in the class.
May be one solution is to rename RBReplaceMessageSendTransformation into RBReplaceSelfMessageSendTransformation and make sure that the matcher only matches self.
Right now if you want to replace #old by #new, the method new should be defined in the class of the method containing #old. However the refactoring will happily perform the following change
into
So there is a misconception between the existence of the method and the fact that the transformation is applied.
The check that a method should be defined in the class is good for rename (rename is using RBReplaceMessageSendTransformation) because during renaming a new method with the new name is defined in the class.
May be one solution is to rename RBReplaceMessageSendTransformation into RBReplaceSelfMessageSendTransformation and make sure that the matcher only matches self.