Java and Kotlin by IntelliJ IDEA Help

Code refactoring

Java and Kotlin by IntelliJ IDEA brings IntelliJ IDEA refactorings and code generation to your Java and Kotlin projects.

Rename

The Rename refactoring changes the name of a symbol and updates every reference to it. Place the caret on a declaration or a usage, press ⌃ R, type the new name, and confirm. Java and Kotlin by IntelliJ IDEA propagates the change across the project.

Extract and inline refactorings

Extract refactorings move a fragment of code into a new declaration, and inline refactorings do the reverse, replacing a declaration with its contents. For Java, the extension provides the following refactorings:

  • Extract Method turns the selected statements into a new method and replaces the selection with a call to it. Select the code and press ⌘ ⌥ M.

  • Extract Variable assigns the selected expression to a new variable. Select the expression and press ⌘ ⌥ V.

  • Extract Constant assigns the selected expression to a new constant.

  • Extract Field introduces a new field initialized with the selected expression.

The following inline refactorings are available:

  • Inline Variable replaces references to a variable with its value and removes the declaration. It reverses the result of Extract Variable.

To run an extract or inline refactoring that has no dedicated shortcut, open the code actions list with ⌥ ⏎ and select the refactoring.

Code formatting

Java and Kotlin by IntelliJ IDEA reformats your code according to the code style for the language. To reformat the current file, press ⌥ ⇧ F.

File templates

Java and Kotlin by IntelliJ IDEA provides file templates that generate the initial contents of new files, such as the package declaration and the top-level element. For a list of available file templates, refer to File Templates.

27 July 2026