Community
Participate
Working Groups
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?
Unclear if this should be a refactoring or a quick assist. Martin, what do you think.
a quick assist I would say.
if then else -> switch is harder (only constants can be used in switch conditions) the other way looks trivial definitely a quick assist
Notice that the JDK 1.5 enum feature supports switch statements.
We have no plans to implement this.