Bug 546984 - 'Add missing case statements' generate unordered values.
Summary: 'Add missing case statements' generate unordered values.
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.12   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-05 05:51 EDT by Aurélien Mora CLA
Modified: 2023-08-08 04:34 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aurélien Mora CLA 2019-05-05 05:51:04 EDT
With JDT included in Eclipse 19-06 M1, using the quick action 'Add missing case statements' will generate unordered case statements. 

For example, with this enum:
public enum ENodeIndex
{
	TIP,
	LEFT,
	MIDDLE,
	RIGHT
}

The generated code is:

switch (index)
{
case LEFT:
	break;
case MIDDLE:
	break;
case RIGHT:
	break;
case TIP:
	break;
default:
	break;
}

I think it would be better to keep the enum order.
Comment 1 Eclipse Genie CLA 2021-04-25 17:42:16 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 2 Eclipse Genie CLA 2023-04-16 09:16:25 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 3 Sam Sam CLA 2023-08-08 04:34:35 EDT
Hello,
I also encounter this issue, I think the 'Add missing case statements' action should keep the enum order.
But, as it's a matter of point of view, there should be an option in the preferences to keep the current behavior (i.e. alphabetical order).