Bug 165703 - [ast rewrite] Enum constants are always separated by ", "
Summary: [ast rewrite] Enum constants are always separated by ", "
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on: 184485
Blocks:
  Show dependency tree
 
Reported: 2006-11-23 14:26 EST by Dmitry Denisov CLA
Modified: 2019-06-27 07:14 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Denisov CLA 2006-11-23 14:26:03 EST
Newly added enum constants seem to be always separated by a comma with a following space.

For example, if I would like to add a constant with a Javadoc to an existing list of enum constants, I am getting the output like this:

enum E {
  /**
   * javadoc 1
   */
  ENUM_CONST_1, /**
   * javadoc 2
   */
  ENUM_CONST_2;
}

Would it be possible to use logic similar to adding body declarations? E.g. determine separating new lines based on either existing constants or, if they do not exist, use DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS?

The ", " string is hardcoded on line 3029 in ASTRewriteAnalyzer, method visit(EnumConstantDeclaration node). This value seems to be used later without modifications in the inner class ListRewriter...
Comment 1 Martin Aeschlimann CLA 2007-04-30 07:22:48 EDT
I have a fix ready, but I have troubles with formatting the enum constants: see bug 184485
Comment 2 Martin Aeschlimann CLA 2007-05-14 09:52:55 EDT
for 3.4 as this is more a presentation issue, no wrong code generated.
Comment 3 Jerome Lanneluc CLA 2008-05-07 07:28:17 EDT
Deferring post 3.4 as we ran out of time
Comment 4 Eclipse Genie CLA 2019-06-27 07:14:52 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.