IntelliJ IDEA 2017.2 Help

Extract Parameter Dialog for Java

Refactor | Extract | Parameter
Refactor | Extract | Functional Parameter

Specify the settings for extracting a parameter. See Extract Parameter in Java and Extract Functional Parameter.

Parameter of type Specify the type of the new parameter. Usually, you don't need to change the type suggested by IntelliJ IDEA.
Name Specify the name for the new parameter.
Replace all occurrencesSelect this option to replace all the occurrences of the selected expression within the method.
Declare finalSelect this option to declare the parameter final.
Delegate via overloading method Select this option to keep the existing method calls unchanged.

As a result, a new overloading method will be created and the new parameter will be added to the definition of this method. The method with the old signature will be kept. The call to the new method will be added to the old method. The necessary value (or expression) will be passed to the new method in this call.

The following options are available if the expression contains a direct call to a class field that has a getter.
Do not replaceSelect this option to use a direct call to the field regardless of the scope context.
Replace fields inaccessible in usage contextSelect this option to use a call to the getter only where a field is directly inaccessible.
Replace all fieldsSelect this option to use a call to the getter.
The following options are available when the refactored expression contains local variables.
Delete variable definitionSelect this option to remove the definition of a local variable.
Use variable initializer to initialize parameterSelect this option to use the default value of the selected variable in the corrected method calls.

It is strongly recommended that you select both check boxes. Otherwise, the code may become uncompilable.

Last modified: 29 November 2017

See Also