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

Bug 268675

Summary: [extract class] Refactor/Extract Class seems incomplete
Product: [Eclipse Project] JDT Reporter: benson margulies <bimargulies>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, Olivier_Thomann
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description benson margulies CLA 2009-03-15 12:51:36 EDT
Build ID: M20080911-1700

Steps To Reproduce:
1. Run Refactor/Extract Class
2. Select some fields

Issues:

1) It chooses the first field as the constructor argument of the new class. It should allow the user to pick the construction policy.

2) It constructs the new object in the old class with a 'new' at the point of declaration. It should allow selection of a constructor, or to defer that to manual editing.

3) It does not offer to move any methods.

4) It does not encapsulate the fields of the new class in getters and setters, but rather leaves them public. There could at least be an option.




More information:
Comment 1 Olivier Thomann CLA 2009-03-15 14:30:10 EDT
Move to JDT/UI
Comment 2 Dani Megert CLA 2009-03-16 04:28:50 EDT
As of 3.5 M6:

1) is not true: it creates the constructors that are necessary to perform the 
   refactoring.

2) not trivial as this could result in semantic changes of the code.

3) this is as designed: the refactoring is there to encapsulate fields into a new 
   class and not to move methods.

4) this is not true as of 3.5 M6: you can choose to generate getters and setters
   which results in the fields being private. However, it is not possible to
   specify the access modifier. Field bug 268720 for this.

If you do not agree with closing 1-3 you can file new bug reports one for each individual issue.
Comment 3 benson margulies CLA 2009-03-16 07:16:22 EDT
I had better try out 3.5M6.