Should renaming an overriden method also rename other overrides of the base method?

When i go to rename a method in a derived class, I get the dialog that asks if I want to refactor from the base method, which I do.

 

However, only methods and usages in the super hierarchy of the method I'm renaming get refactored.  Other "sibling" classes that have overrides of the base method don't get renamed.  It seems like they should, but maybe there is something I'm missing?

 

 

0
2 comments

Hi David.

Please add your comments or upvote the issue: https://youtrack.jetbrains.com/issue/OC-11598.

0
Avatar
Permanently deleted user

thank you! I suppose i should have found that in my search  :).  The existing comment does says that it is a swift bug, but i see it in objc.

Here are my comments:

  • I see this in objc. If i rename an overriden method, all overrides in its hierarchy up to the base get renamed, but other overrides of that base in "sibling" classes do not.
  • This is actually not just an inconvenience but can introduce bugs, as the un-renamed overridden methods can still compile but no longer get called.
  • One of the hallmark of refactoring is that you can do it with complete confidence that the code does not introduce the types of error that copy/paste can. This bug breaks that confidence, and can do so silently!
0

Please sign in to leave a comment.