How can I apply the “move method” refactoring with IntelliJ IDEA?

前端 未结 5 766
感情败类
感情败类 2021-02-01 17:53

I want to be able to move an instance method from one class to another class (\"Move method\" from Fowler\'s \"Refactoring\") in IntelliJ IDEA. Unfortunately, when I try \"Move.

5条回答
  •  面向向阳花
    2021-02-01 18:11

    In intellij 13.1 (dont' know in previous version) it could be done with the

    Choose Refactor | Extract | Delegate on the main menu

    but there is a "strange" limit, apparently: it could be done only with a new freshly created class. So you have to do apply this refactoring without creating the "OtherClass" (it will be create directly when you apply the refactoring).

    So a real "move" of method on an alredy created class seems missing, quite strange behaviou

提交回复
热议问题