Bug 64698 - [rename] include parameter name when renaming field and getter
Summary: [rename] include parameter name when renaming field and getter
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 enhancement with 4 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 65104 108188 152168 198026 368625 454331 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-30 08:04 EDT by Lukasz Osipiuk CLA
Modified: 2014-12-08 09:12 EST (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukasz Osipiuk CLA 2004-05-30 08:04:41 EDT
When renaming a field with "rename setter" option checked, only the name of a
setter is changed. The parameter of setter stays with old variable name.
It would be nice if setter parameter was changed to new name too.

Example:

Before refactoring i have:

    int a;
    
    public void setA(int a) {
        this.a = a;
    }

---------
and after:

    int b;
    
    public void setB(int a) {
        this.b = a;
    }
Comment 1 Martin Aeschlimann CLA 2006-06-14 03:51:04 EDT
*** Bug 65104 has been marked as a duplicate of this bug. ***
Comment 2 Martin Aeschlimann CLA 2006-08-02 13:10:01 EDT
*** Bug 152168 has been marked as a duplicate of this bug. ***
Comment 3 Martin Aeschlimann CLA 2006-08-03 12:29:32 EDT
*** Bug 108188 has been marked as a duplicate of this bug. ***
Comment 4 Martin Aeschlimann CLA 2007-07-30 03:55:14 EDT
*** Bug 198026 has been marked as a duplicate of this bug. ***
Comment 5 Ivan CLA 2011-11-23 08:03:55 EST
I vote for this bug.

Also @param JavaDoc annotations are corrupted after such renaming. In this example "foo" -> "bar":

public class Fb {
	private String foo;

	/**
	 * The constructor for creating Fb instance.
	 * @param foo The foo.
	 */
	public Fb(String foo) {
		this.foo = foo;
	}
	
	/** @param foo The foo to set. */
	public void setFoo(String foo) {
		this.foo = foo;
	}
}


public class Fb {
	private String bar;

	/**
	 * The constructor for creating Fb instance.
	 * @param bar The bar.
	 */
	public Fb(String foo) {
		this.bar = foo;
	}
	
	/** @param bar The bar to set. */
	public void setBar(String foo) {
		this.bar = foo;
	}
}
Comment 6 Markus Keller CLA 2012-01-16 12:02:13 EST
*** Bug 368625 has been marked as a duplicate of this bug. ***
Comment 7 Rudolf Schmidt CLA 2012-04-25 19:58:34 EDT
Iam using Eclipse Version: 3.7.2 and this bug is still contained.
Comment 8 Rudolf Schmidt CLA 2012-04-25 20:04:48 EDT
(In reply to comment #7)
> Iam using Eclipse Version: 3.7.2 and this bug is still contained.

Plz fix it soon.
Comment 9 Markus Keller CLA 2012-04-26 09:29:04 EDT
Rudolf asked me where the code is. See RenameFieldProcessor in the org.eclipse.jdt.ui plug-in.

Note that we will only accept a patch that ensures that the new parameter names doesn't conflict with existing local variables in the method and that updates all occurrences of the variables. Rename participants also need to be notified correctly, etc.

The solution will probably look similar to RenameTypeProcessor.fUpdateSimilarElements et al., see http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=cff85fa69f762dac24e3aba194f9d675df7770ec

Tests can go to RenamePrivateFieldTests (and resources are in /org.eclipse.jdt.ui.tests.refactoring/resources/RenamePrivateField/).
Comment 10 Rudolf Schmidt CLA 2012-05-01 15:09:34 EDT
Maybe some other developer can help me. i have checked out the org.eclipse.jdt.ui plug-in from git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git and even found the files RenameFieldProcessor and RenamePrivateFieldTests :-)

now, may problem are unresolved packages. for example 

line 35 import org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor; in RenamePrivateFieldTests with the message: "The import org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor cannot be resolved"

dunno how to handle it. maybe i get any help here.
Comment 11 Dani Megert CLA 2012-05-02 03:14:23 EDT
(In reply to comment #10)
> Maybe some other developer can help me. i have checked out the
> org.eclipse.jdt.ui plug-in from
> git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git and even found the files
> RenameFieldProcessor and RenamePrivateFieldTests :-)
> 
> now, may problem are unresolved packages. for example 
> 
> line 35 import
> org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor; in
> RenamePrivateFieldTests with the message: "The import
> org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor cannot
> be resolved"
> 
> dunno how to handle it. maybe i get any help here.

Maybe this helps: http://wiki.eclipse.org/JDT_UI/How_to_Contribute
Comment 12 Rudolf Schmidt CLA 2012-05-03 05:06:11 EDT
tanks(In reply to comment #11)
> (In reply to comment #10)
> > Maybe some other developer can help me. i have checked out the
> > org.eclipse.jdt.ui plug-in from
> > git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git and even found the files
> > RenameFieldProcessor and RenamePrivateFieldTests :-)
> > 
> > now, may problem are unresolved packages. for example 
> > 
> > line 35 import
> > org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor; in
> > RenamePrivateFieldTests with the message: "The import
> > org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor cannot
> > be resolved"
> > 
> > dunno how to handle it. maybe i get any help here.
> 
> Maybe this helps: http://wiki.eclipse.org/JDT_UI/How_to_Contribute

thanks for your comment. i checked 

git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.text.git
git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.git
git://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git

out and have still the same message.

The import org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor cannot be resolved
Comment 13 Markus Keller CLA 2014-12-08 09:12:31 EST
*** Bug 454331 has been marked as a duplicate of this bug. ***