IntelliJ IDEA Tips & Tricks #59: Automatically Collapse Superclass With "Inline Superclass"

Опубликовано: 19 Июль 2026
на канале: CodeOpsTech
1,262
13

Sometimes, in object oriented design we mistake a instance for a derived class.


For example, PNGImage need not be a derived class of Image. On the other hand, if you only want PNGImage with support for other image types, you could collapse the inheritance hierarchy.


In IntelliJ IDEA, you can point at a derived class and select Ctrl + T to get the Refactor This menu and choose "Inline Superclass" option to collapse the base class. This video demonstrates an example.