Type migration
Refactor | Type Migration
CtrlShiftF6
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.
In the editor, highlight or place the caret at a type you want to refactor.
Press CtrlShiftF6 or in the main menu, go to Refactor | Type Migration.
In the dialog that opens, specify the new type and scope where to look for the usages.
f: int -> String
Before | After |
---|---|
|
|
I<String> -> I<Integer>
Before | After |
---|---|
|
|
myResult: ArrayList<String> -> String[]
Before | After |
---|---|
|
|
This dialog appears when you invoke the Type Migration 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 , 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. |
Thanks for your feedback!