Type migration
Last modified: 02 August 2022The Type Migration refactoring lets you automatically change a member type (e.g. from integer to string), and data flow dependent type entries, like method return types, local variables, parameters etc. across the entire project.
It also lets you automatically convert 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 Ctrl+Shift+F6 or on the main menu, select Refactor | Type Migration.
In the dialog that opens, specify the new type and scope where to look for the usages.
Examples
f: int -> String
Before | After |
---|---|
|
|
I<String> -> I<Integer>
Before | After |
---|---|
|
|
myResult: ArrayList<String> -> String[]
Before | After |
---|---|
|
|