IntelliJ IDEA
 
Get IntelliJ IDEA

Pull members up, push members down

Last modified: 08 October 2024

The Pull Members Up refactoring lets you move fields if two classes have the same field, or move methods if your subclasses have methods performing similar work. This helps you to get rid of duplicate code. You can also move class members to a superclass or an interface, or interface to superinterface.

The Push Members Down refactoring lets you clean up the class hierarchy by moving class members to a subclass or a subinterface. The members are then relocated into the direct subclasses/interfaces only. This improves internal class coherency.