IntelliJ IDEA provides the following inline refactorings:
- Inline Variable refactoring replaces redundant variable usage with its initializer. See example. This refactoring is opposite to the Extract Variable refactoring.
- Inline Method refactoring results in placing method's body into the body of its caller(s). You can opt to:
- inline all occurrences of the method, and delete the method
- inline only a single occurrence, and retain the method
This refactoring is opposite to Extract Method.
- Inline to Anonymous Class refactoring allows replacing redundant class with its contents. Starting with Java 8, the inlined anonymous classes can be converted to lambdas automatically. See example.
- Inline Constructor allows compressing a chain of constructors, if one of them is a special case of another. See example.
- Inline JSP/JSPX works like a regular Java inline refactoring.
- Inline Superclass refactoring results in pushing superclass' methods into the class where they are used, and removing the superclass.
Inline to Anonymous Class
Perforaming inline refactoring
To perform the inline refactoring
Last modified: 26 October 2017