Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312347 - [refactoring] Extract Class refactoring should transfer methods
Summary: [refactoring] Extract Class refactoring should transfer methods
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P5 normal with 11 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-10 18:02 EDT by kcassell2001 CLA
Modified: 2019-09-18 08:11 EDT (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kcassell2001 CLA 2010-05-10 18:02:47 EDT
Build Identifier:  M20100211-1343

Fowler, the author of the refactoring book that everybody references, says of the Extract Class refactoring: "Create a new class and move the relevant fields and methods from the old class into the new class." (http://www.refactoring.com/catalog/extractClass.html).  The Extract Class in Eclipse only moves the fields.

For Bug 268675 - [extract class] Refactor/Extract Class seems incomplete, Dani Megert states: "this is as designed: the refactoring is there to encapsulate fields into a new class and not to move methods."

This is counter to the most widely used definition.  Either this refactoring should be renamed or (better) the missing move methods functionality should be added.  IntelliJ's Extract Class does this, although buggily.


Reproducible: Always

Steps to Reproduce:
1. Use Eclipse to edit a Java class
2. Refactor->Extract Class
3. A popup appears in which there are fields but no methods.
Comment 1 Olivier Thomann CLA 2010-05-10 18:33:45 EDT
Move to JDT/UI
Comment 2 Markus Keller CLA 2010-05-20 09:54:43 EDT
The Move Instance Method refactoring currently only works for a single method (bug 47712). Once that works for multiple methods, we could consider using it for Extract Class as well.
Comment 3 Eclipse Genie CLA 2019-09-17 13:43:11 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Mauro Molinari CLA 2019-09-18 08:11:59 EDT
This still applies to Eclipse 2019-06.

It's worth to note that the "Extract superclass" refactoring allows to select methods as well.