Bug 38018 - [quick assist] New Refactoring: if-then-else <-> switch
Summary: [quick assist] New Refactoring: if-then-else <-> switch
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-23 04:37 EDT by Robert Klemme CLA
Modified: 2010-06-09 02:14 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Klemme CLA 2003-05-23 04:37:25 EDT
In cases where the type of an "enum" changes from some class to an int (for 
example during performance optimizations) it would be helpful to be able to 
transform an "if()else if() ... else" cascade into a switch statement.

On the contrary, when one started out with an int and changed that to a class 
because one needs more semantics and type safety, it would be convenient to be 
able to transform a switch automatically into an "if()else if()else" cascade.

Alternatively there could be a refactoring on a higher semantic level, i.e., 
take a set of scalar constants and transform it into an enumeration pattern 
class...

What do others think?
Comment 1 Dirk Baeumer CLA 2003-05-23 10:58:44 EDT
Unclear if this should be a refactoring or a quick assist. Martin, what do you 
think.
Comment 2 Martin Aeschlimann CLA 2003-05-26 04:31:36 EDT
a quick assist I would say. 
Comment 3 Adam Kiezun CLA 2003-05-28 05:37:33 EDT
if then else -> switch is harder (only constants can be used in switch 
conditions)

the other way looks trivial
definitely a quick assist
Comment 4 Ilja Preuss CLA 2004-05-26 07:12:15 EDT
Notice that the JDK 1.5 enum feature supports switch statements.
Comment 5 Markus Keller CLA 2010-06-09 02:14:40 EDT
We have no plans to implement this.