问题
Suppose I have a class like this.
Public class MyClass{
private String id;
public Myclass(String id){
this.id = id;
}
public String getId(){
return id;
}
public void setId(String id){
this.id = id;
}
}
And suddenly I want to change the type of id
into Integer
. Is there a way to do that with intellij without breaking usages?
回答1:
Highlight the type of field and press Ctrl+Shift+F6
or
Highlight the type of field, Right-Click -> Refactor -> Type migration
or
Highlight the type of field, Menu -> Refactor -> Type migration
来源:https://stackoverflow.com/questions/38428155/how-to-safe-change-the-type-of-a-variable-intellij