Change Method Signature
The change method signature refactoring allows you to add, reorder or remove the arguments of a method. All updates to existing method calls will be automatically performed.
Place the cursor on the desired method, right-click and go to Refactor > Change Method Signature or simply press Shift+Alt+C.
In the Change Method Signature dialog you can modify the method’s name and arguments.
Method name changes are equivalent with Rename Refactoring.
The list of arguments can be manipulated by using the buttons on the right side of the table.
- Add: Add a new argument at the end of the list. You will be prompted to provide:
the argument type
the argument name
the actual argument to be used in existing function calls
Remove: Remove the selected argument. The selected argument will not be part of the list anymore and will be erased from function calls as well.
Up/Down: Change the position of the selected argument.
Note
The dialog status area presents validation information, such as duplicate parameters, invalid identifier names and duplicate methods.
Click OK to perform the refactoring, or Preview to see the changes that are about to be performed in the source code. In the Preview page you can select the changes that should be performed. After you click Finish the changes are performed, and the project is rebuilt.
Note
This functionality works only for ANSI style methods.
Note
In specific preprocessing scenarios - for example when a method declaration or a method call lies within a macro expansion - the refactoring cannot be automatically carried out. A FIXME comment will be inserted in the relevant code location and will show up in the Tasks View. See Track Tasks using TODO Markers.