Example
f: int -> String
| Before | After |
|---|---|
int f; void bar(int i) {} void foo() { bar(f); } |
String f; void bar(String i) {} void foo() { bar(f); } |
I<String> -> I<Integer>
| Before | After |
|---|---|
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; } } |
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 |
|---|---|
public class ResultContainer { private ArrayList<String> myResult; public String[] getResult() { return myResult.toArray(new String[myResult.size()]); } } |
public class ResultContainer { private String[] myResult; public String[] getResult() { return myResult; } } |
- Place the caret on the type to be refactored in the editor.
- On main menu, choose , or press Ctrl+Shift+F6Ctrl+Shift+F6.
- In the Type Migration dialog box, specify the new type and scope where to look for the usages.
- Click Preview and review the items that will be affected. If needed, exclude usages from refactoring. To do that, right-click usage in the Type Migration Preview and select Exclude. When done, click Migrate.

