How to safe change the type of a variable intellij?

独自空忆成欢 提交于 2020-06-27 09:18:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!