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

前端 未结 5 736
感情败类
感情败类 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:04

    if theMethod() has nothing reference to the host class(TheClass), you can make this method static and then use "Move" command. After the method was moved to the target class, you should remove the static keyword.

提交回复
热议问题