| Summary: | [encapsulate field] Encapsulate Field doesn't use code style settings for setter parameter name | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Chris S <devnullaccount> | ||||||
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> | ||||||
| Status: | CLOSED DUPLICATE | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | markus.kell.r | ||||||
| Version: | 3.7.2 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Chris S
Created attachment 217271 [details]
example project
Works fine for me in the attached project.
Note that method comments are only generated if you either
- check "Generate method comments" in the "Encapsulate Field" dialog, or
- check "Automatically add comments for new methods and types" in the "Code Templates" properties page
. Created attachment 217374 [details]
Template file that exhibits the problem
I tried to diff my org.eclipse.jdt.ui.prefs with the one you attached and I can't see why mine would misbehave, but I cn clearly repeat the problem.
For example, we have a policy that a method argument should have the naming convention "aSomething" ("a" as a prefix) and this works when I generate getters and setters "normally":
/**
* TODO: Write something here
* @param aMyField the myField to set
*/
public void setMyField(String aMyField) {
myField = aMyField;
}
But when I do the quick fix, the setter looks like this instead
/**
* TODO: Write something here
* @param myField the myField to set
*/
public void setMyField(String myField) {
this.myField = myField;
}
So yes, it generates the javadoc correctly, but it does not follow the naming convention.
I should have been more clear in my previous example. Try repeating it with the attached file instead
OK, so the problem is that the Encapsulate Field refactoring doesn't use the Java Code Style settings to generate the setter parameter name. *** This bug has been marked as a duplicate of bug 252779 *** |