Supun Wijerathne
Supun Wijerathne

Reputation: 12948

How to safe change the type of a variable intellij?

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?

Upvotes: 9

Views: 3249

Answers (1)

Rahul Teotia
Rahul Teotia

Reputation: 204

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

Upvotes: 16

Related Questions