Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the simplest way to merge two classes in Intellij IDEA?

I have:

class Parent {} class Child1 extends Parent{} class Child2 extends Parent{}

I am using all three classes (especially child classes) everywhere in my application. Now the decision was made that child classes should be removed, instead parent class need to hold fields (and methods) from both child classes. How can I easily get needed result?

Only thing came to my mind is to move all child data to Parent class and then Ctrl+Shift+R to replace all occurrences of the old classes. Still I wonder, is there a better way to achieve that?

like image 298
LaRRy Avatar asked Sep 09 '13 17:09

LaRRy


1 Answers

Intellij IDEA has a pull members up refactoring that can help.

like image 78
Daniel Kaplan Avatar answered Nov 03 '22 02:11

Daniel Kaplan