Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 315363

Summary: [encapsulate field] Encapsulate Field quickfix generate getter and setter in the wrong order
Product: [Eclipse Project] JDT Reporter: pihentagy+eclipse+bugzilla
Component: UIAssignee: Raksha Vasisht <raksha.vasisht>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: deepakazad, markus.kell.r, Olivier_Thomann
Version: 3.5.2   
Target Milestone: 3.7 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Test fixes none

Description pihentagy+eclipse+bugzilla CLA 2010-06-02 05:42:17 EDT
Build Identifier: 20100218-1602

Two ways of generating getters and setters generate them in different order, and cannot configure them to produce it in the same order.

Reproducible: Always

Steps to Reproduce:
1. Create a protected field
2. Ctrl+1 on the field 
3. Create getter and setter
RESULT: set... and get... methods in that order 

1. Create a protected field
2. Right click - Source - Generate getters and setters
RESULT: get... and set... methods in  that order (and cannot modify the order)
Comment 1 Olivier Thomann CLA 2010-06-02 06:47:55 EDT
Move to JDT/UI
Comment 2 Markus Keller CLA 2010-06-02 10:42:59 EDT
The quick fix is the same as Refactor > Encapsulate Field. I agree that this should create the getter first.

Raksha, could you please have a look? Remember to adjust the tests as well.
Comment 3 Raksha Vasisht CLA 2010-06-17 14:03:05 EDT
(In reply to comment #2)
> The quick fix is the same as Refactor > Encapsulate Field. I agree that this
> should create the getter first.
> 
> Raksha, could you please have a look? Remember to adjust the tests as well.

Fixed in HEAD.
Comment 4 Raksha Vasisht CLA 2010-06-18 06:15:02 EDT
(In reply to comment #3)

> Fixed in HEAD.

Fixed in these files :
org.eclipse.jdt.internal.corext.refactoring.sef.SelfEncapsulateFieldRefactoring
org.eclipse.jdt.ui.tests.quickfix.GetterSetterQuickFixTest
Comment 5 Raksha Vasisht CLA 2010-06-18 09:05:16 EDT
Created attachment 172213 [details]
Test fixes

More tests fixed and released to HEAD.
Comment 6 Deepak Azad CLA 2010-08-03 13:58:22 EDT
Verified with I20100802-1800 on Ubuntu.