Refactor Java function with default parameters

I often find myself performing the following refactor in Java:

public void someMethod () {
     // Do something
}

into:

public void someMethod() {
     someMethod("default value");
}

public void someMethod(String newParameter) {
     // Do something slightly different
}

Doing it this way avoids having to add the "default value" parameter to all code that references someMethod. Is there a way to perform this refactor automatically in IntelliJ?

Thanks.

1 comment

Never mind... I found it. "Delegate via overloading method" radio on the Change Signature dialog.

0

Please sign in to leave a comment.