Bug 166959 - [ast rewrite] Field added to empty enum is not indented correctly
Summary: [ast rewrite] Field added to empty enum is not indented correctly
Status: NEW
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:
Blocks:
 
Reported: 2006-12-06 09:59 EST by Dmitry Denisov CLA
Modified: 2022-08-20 14:40 EDT (History)
1 user (show)

See Also:


Attachments
Test case illustrating the problem (2.64 KB, application/octet-stream)
2006-12-06 10:01 EST, Dmitry Denisov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Denisov CLA 2006-12-06 09:59:44 EST
Build ID: I20061102-1715

Adding a constant and a field to the following empty enum:

enum E
{
}

results in the field not indented correctly:

enum E
{
	MISSING;

int MISSING;
}


The following code has been used to insert constant and a field:

    EnumDeclaration ed = (EnumDeclaration)cu.types().get(0);

    // add enum constant
    ListRewrite lrw = rewriter.getListRewrite(ed, EnumDeclaration.ENUM_CONSTANTS_PROPERTY);
    EnumConstantDeclaration newConstant = cu.getAST().newEnumConstantDeclaration();
    lrw.insertLast(newConstant, null);

    // and field
    VariableDeclarationFragment newFragment = cu.getAST().newVariableDeclarationFragment();
    FieldDeclaration newField = cu.getAST().newFieldDeclaration(newFragment);

    lrw = rewriter.getListRewrite(ed, ed.getBodyDeclarationsProperty());
    lrw.insertLast(newField, null);
Comment 1 Dmitry Denisov CLA 2006-12-06 10:01:25 EST
Created attachment 55136 [details]
Test case illustrating the problem
Comment 2 Eclipse Genie CLA 2020-08-07 14:31:24 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 Eclipse Genie CLA 2022-08-20 14:40:03 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.