Renaming a method

You can rename a method by modifying its declaration in the compilation unit in which it is declared. However, if you also want to update all references to it, you must either:
  1. In a Java view presenting methods (for example the Outline view) select the method to be renamed.
  2. From the view's pop-up menu, select Refactor > Rename or select Refactor > Rename from the global menu bar.
or
  1. In a Java editor, select a reference to or the declaration of the method to be renamed.
  2. From the editor's pop-up menu, select Refactor > Rename or select Refactor > Rename from the global menu bar.
Note 1:  Renaming a method declared in an interface also renames (and updates all references to) all methods that are implementations of that method
Note 2:  When renaming a non-static method declared as public, package visible, or protected, all methods overriding it are also renamed and all references to them are updated.
Note 3: Renaming a static method or a private method updates references only to that method.


Related concepts

Java development tools (JDT)

Related tasks

Extracting a method
Overriding a method
Renaming method parameters

Related reference

Override methods
Refactoring actions
Refactoring wizard
Refactoring preferences
 

Copyright IBM Corporation 2000, 2002. All Rights Reserved.