blob: ba6fd27635d5db2253aa240dd3bb659c35bc1996 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
<title>
Renaming a method
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
</head>
<body>
<h1>
Renaming a method
</h1>
<p>
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:
</p>
<ol>
<li>
In a Java view presenting methods (for example the Outline view) select the method to be renamed.
</li>
<li>
From the view's pop-up menu, select <strong>Refactor</strong> &gt; <strong>Rename</strong> or select <strong>Refactor</strong> &gt; <strong>Rename</strong> from the global menu bar.
</li>
</ol>
<p>
or
</p>
<ol>
<li>
In a Java editor, select a reference to or the declaration of the method to be renamed.
</li>
<li>
From the editor's pop-up menu, select <strong>Refactor</strong> &gt; <strong>Rename</strong> or select <strong>Refactor</strong> &gt; <strong>Rename</strong> from the global menu bar.
</li>
</ol>
<p>
<strong>Note 1:</strong> Renaming a method declared in an interface also renames (and updates all references to) all methods that are implementations of that method.
</p>
<p>
<strong>Note 2:</strong> 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.
</p>
<p>
<strong>Note 3:</strong> Renaming a static method or a private method updates references only to that method.
</p>
<p>
<img src="../images/ngrelc.gif" alt="Related concepts" border="0" height="27" width="159">
</p>
<p>
<a href="../concepts/concepts-1.htm">Java development tools (JDT)</a>
</p>
<p>
<img src="../images/ngrelt.gif" alt="Related tasks" border="0" height="27" width="159">
</p>
<p>
<a href="tasks-87.htm">Extracting a method</a><br>
<a href="tasks-43.htm">Overriding a method</a><br>
<a href="tasks-98.htm">Renaming method parameters</a>
</p>
<p>
<img src="../images/ngrelr.gif" alt="Related reference" border="0" height="27" width="159">
</p>
<p>
<a href="../reference/ref-dialog-override-method.htm">Override methods</a><br>
<a href="../reference/ref-menu-refactor.htm">Refactoring actions</a><br>
<a href="../reference/ref-117.htm">Refactoring dialogs</a><br>
<a href="../reference/ref-23.htm">Refactoring preferences</a>
</p>
<p>
<a href="../hglegal2003.htm"><img src="../images/ngibmcpy2003.gif" alt="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." border="0" width="324" height="14"></a>
</p>
</body>
</html>