Change signature
Shortcut: Ctrl+F6
Refactoring settings: Settings/Preferences | Editor | General
Access from UML Class diagram is available
In-place refactoring is available
The Change Signature refactoring combines several different modifications that can be applied to a method signature or a class signature.
For a class, this refactoring can turn a class into a generic and manipulate its type parameters. It automatically corrects all calls, implementations and overridings of the class.
For a method, this refactoring can change the method name, add, remove, reorder, and rename parameters and exceptions, and propagate new parameters and exceptions through the hierarchy of calls.
Change signature in place
In the editor, start adding or editing the parameter of a class or a method. IntelliJ IDEA will display
in the gutter.
- Click the icon in the gutter or press Alt+Enter.
If you are adding a new parameter, IntelliJ IDEA will offer you to add a default value for it as well as update the usages.
If you are editing a parameter, IntelliJ IDEA will offer to update the usages for you.
Click Update to apply suggestions.
Invoke the Change Signature dialog
Select method or a class for which you want to change signature.
From the context menu, select Refactor | Change Signature (Ctrl+F6 ).
In the dialog that opens depending on what you're changing signature for, specify the appropriate options and click Refactor. If you want to see a preview of your potential changes, click Preview.
Change Class Signature example
Let's add type parameters Param1, Param2
to a class MyClass
.
String and Integer are default values that were specified in the Change Class Signature dialog for Param1
and Param2
respectively.
You can also add a bounded value for a parameter to put some restrictions on what gets passed to the type parameter. For example, add Param3
with default value List
and bounded value Collection

Before | After |
---|---|
|
|
tip
The refactoring may be useful for changing the parameter order in the class signature as well as in all its usages.
note
For Kotlin, this refactoring works the same as for Java. You can press Ctrl+Alt+Shift+K to convert your Java code to Kotlin.
Change Method Signature example
You can add parameters to a method and specify different options in the Change Method Signature dialog to have different results.
You can also add exceptions to a method and they will be propagated in a call hierarchy.
note
The Change Method Signature refactoring is applicable to a constructor. In this case, however, the name and the return type cannot be changed.
note
If the method contract is specified by the
@Contract
annotation, the Change Method Signature refactoring also tries to convert such methods. Yet, in some cases the refactoring might fail and your would need to adjust contract manually.

tip
To see the Change Method Signature refactoring examples for languages other than Java, refer to the following topics: