# Type migration

> **TL;DR**
> `Refactor | Type Migration`
>
>
>
> `Ctrl+Shift+F6` (Windows), `⌘ ⇧ F6` (macOS), `⌘ ⇧ F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ F6` (macOS System Shortcuts), `Ctrl+Shift+F6` (XWin), `Ctrl+Shift+F6` (GNOME), `Ctrl+Shift+F6` (KDE), `Ctrl+Shift+F6` (Emacs), `Ctrl+Shift+F6` (Sublime Text), `Ctrl+Shift+F6` (Sublime Text (macOS)), `Ctrl+Shift+F6` (NetBeans), `Ctrl+Shift+F6` (Visual Studio), `⌘ ⇧ F6` (Visual Studio (macOS)), `Ctrl+Shift+F6` (Eclipse), `Ctrl+Shift+F6` (Eclipse (macOS))

The Type Migration refactoring lets you automatically change a member type (such as from integer to string), and data flow dependent type entries (such as method return types, local variables, parameters, and so on) across the entire project.

It also lets you automatically convert a variable or method return type between arrays and collections. If any conflicts are found IntelliJ IDEA displays the appropriate message.

> **Tip:**
> This refactoring is also available from [UML Class diagram](class-diagram.html).

Procedure:

1. In the editor, highlight or place the caret at a type you want to refactor.

2. Press `Ctrl+Shift+F6` (Windows), `⌘ ⇧ F6` (macOS), `⌘ ⇧ F6` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ F6` (macOS System Shortcuts), `Ctrl+Shift+F6` (XWin), `Ctrl+Shift+F6` (GNOME), `Ctrl+Shift+F6` (KDE), `Ctrl+Shift+F6` (Emacs), `Ctrl+Shift+F6` (Sublime Text), `Ctrl+Shift+F6` (Sublime Text (macOS)), `Ctrl+Shift+F6` (NetBeans), `Ctrl+Shift+F6` (Visual Studio), `⌘ ⇧ F6` (Visual Studio (macOS)), `Ctrl+Shift+F6` (Eclipse), `Ctrl+Shift+F6` (Eclipse (macOS)) or in the main menu, go to `Refactor | Type Migration`.

3. In the dialog that opens, specify the new type and scope where to look for the usages.

4. [Preview and apply the changes](refactoring-source-code.html#changes_preview).

## Examples

`f: int -> String`

| Before | After |
| --- | --- |
|     ```JAVA int f; void bar(int i) {} void foo() {     bar(f); } ```    |     ```JAVA String f; void bar(String i) {} void foo() {     bar(f); } ```    |

`I<String> -> I<Integer>`

| Before | After |
| --- | --- |
|     ```JAVA interface I<T> {     T foo(T t); }  class A implements I<String> {     String myString;     public String foo(final String s) {         if (s == null) {             return                myString;         }         return s;     } }  ```    |     ```JAVA interface I<T> {     T foo(T t); }  class A implements I<Integer> {     Integer myString;     public Integer foo(final Integer s) {         if (s == null) {             return                myString;         }         return s;     } } ```    |

`myResult: ArrayList<String> -> String[]`

| Before | After |
| --- | --- |
|     ```JAVA public class ResultContainer {     private ArrayList<String> myResult;     public String[] getResult() {         return myResult.toArray(new String[myResult.size()]);     } } ```    |     ```JAVA public class ResultContainer {     private String[] myResult;     public String[] getResult() {         return myResult;     } } ```    |

## Type Migration dialog

This dialog appears when you invoke the [Type Migration](#to_type_migrate) refactoring.

| Item | Description |
| --- | --- |
| Migrate type | Use this list to specify the new type. |
| Choose scope | Use this list to specify the migration scope. Click Browse ![the Browse button](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.ellipsis.svg), if necessary.  |
| Refactor | Click this button to launch refactoring to all usages in the specified scope. If there are any conflicts, IntelliJ IDEA will notify you about them. |
| Preview | Click this button to browse items to be changed, exclude/include them from refactoring, and view the conflicts detected.  |

## See also

### Refactoring

[Code refactoring](refactoring-source-code.html)

