| Summary: | Option to suppress setter for self encapsulation refactoring. | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Steven Spungin <steven> | ||||||||
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> | ||||||||
| Status: | CLOSED DUPLICATE | QA Contact: | |||||||||
| Severity: | minor | ||||||||||
| Priority: | P3 | CC: | noopur_gupta | ||||||||
| Version: | 4.4 | ||||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | All | ||||||||||
| OS: | All | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Steven Spungin
Created attachment 242412 [details]
screenshot 1
Created attachment 242413 [details]
screenshot 2
Created attachment 242414 [details]
screenshot 3
Bug 433691 - Option to suppress setter for self encapsulation please disregard previous link https://git.eclipse.org/r/#/c/25687/ If you want to generate only the getter and not the setter for a field, you can use the "Generate Getters and Setters" refactoring. You have many other options also in that dialog. (Right-click on field > Source > Generate Getters and Setters) "Encapsulate Field" refactoring can be used to insert calls to new or existing setter and getter methods at all locations. For individual locations, once you have created the setter (or getter), you also have the quick assist (Ctrl+1) at that location: "Replace field with setter" (or "Replace field with getter"). For the quick assist "Create getter and setter for field...", see bug 232920. The fix should be applicable to the quick assist which should allow to generate only the setter or only the getter. Please note that "Encapsulate Field" refactoring is used not only to generate setter and getter, but also to insert calls to existing setter and getter methods. *** This bug has been marked as a duplicate of bug 232920 *** Bug 232920 suggests that the field should be blank to suppress. I think the option should be explicit (as I implemented). I use the quickfix hundreds of times a day, and it would be helpful if the option was in that dialog. >> Please note that "Encapsulate Field" refactoring is used not only to >> generate setter and getter, but also to insert calls to existing setter and >> getter methods. How does this implementation interface with that? (In reply to Steven Spungin from comment #7) > Bug 232920 suggests that the field should be blank to suppress. I think the > option should be explicit (as I implemented). That is just one suggestion. Please discuss further in bug 232920. > >> Please note that "Encapsulate Field" refactoring is used not only to > >> generate setter and getter, but also to insert calls to existing setter and >> getter methods. > > How does this implementation interface with that? It was mentioned to take this behavior also into consideration while fixing the bug. For example, would it also be required to insert calls for only setters or only getters? etc. |