Bug 572249

Summary: Cleanup "Use switch instead if-else-if chain" fails when comments are present
Product: [Eclipse Project] JDT Reporter: Andy Man <wlfbck+eclipse>
Component: UIAssignee: Fabrice Tiercelin <fabrice.tiercelin>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: fabrice.tiercelin, kalyan_prasad
Version: 4.20   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard: stalebug
Attachments:
Description Flags
cleanup settings
none
The minimal example to reproduce the bug
none
stack trace of exception during clean up none

Description Andy Man CLA 2021-03-24 04:17:07 EDT
Created attachment 285934 [details]
cleanup settings

Whenever a comment is present in an if-else-if chain the auto refactoring which turns these into a switch fails with an exception, preventing cleanup completely.

I attached a minimal example project.
Comment 1 Andy Man CLA 2021-03-24 04:17:31 EDT
Created attachment 285935 [details]
The minimal example to reproduce the bug
Comment 2 Andy Man CLA 2021-03-24 04:17:43 EDT
Created attachment 285936 [details]
stack trace of exception during clean up
Comment 3 Kalyan Prasad Tatavarthi CLA 2021-03-24 05:17:37 EDT
The cleanup issue is happening due to 'cleanup.switch' option being set to true.

In UI it is "Convert if/else if/else chain to switch".
Comment 4 Eclipse Genie CLA 2023-06-23 17:00:57 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.