Bug 108188 - [refactoring] refactor standard setters should update argument name
Summary: [refactoring] refactor standard setters should update argument name
Status: RESOLVED DUPLICATE of bug 64698
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-27 02:10 EDT by Darryl Miles CLA
Modified: 2006-08-03 12:29 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darryl Miles CLA 2005-08-27 02:10:27 EDT
Enhancement request.

Java language refactor wizard should when refactoring standard object setters
also update the argument name PROVIDING it follows standard java argument
conventions otherwise it should leave as-is.

Before refactor:

public void setMyStringVar(String myStringVar) {
 this.myStringVar = myStringVar;
}

After refactor:

public void setYourStringVar(String myStringVar) {
 this.yourStringVar = myStringVar;
}

Notice the argument name is still "myStringVar".  The code change is simply a
cosmetic change to reduce the change of confusing the developer at a later date
due to thinking this code has never been audited/reviewed.


To test:

1) Create new Class of any name.
2) Create member variable "private String myStringVar;"
3) Create using wizzard standard getters and setters for this member variable.
4) Now highlight variable declaration.
5) Select refactor.
6) Change name to yourStringVar"
7) Tick all the boxes to update getters and setters too.
8) Now look at the change getters and setters code it will look like this:
Comment 1 Dirk Baeumer CLA 2005-08-29 05:25:38 EDT
Markus, we discussed adding updating derived names for type renamed. Doing it
for setter and getter makes sense as well.
Comment 2 Martin Aeschlimann CLA 2006-08-03 12:29:32 EDT

*** This bug has been marked as a duplicate of 64698 ***