Bug 84238 - [1.5] EnumDeclaration.ENUM_CONSTANTS_PROPERTY incorrectly rewritten
Summary: [1.5] EnumDeclaration.ENUM_CONSTANTS_PROPERTY incorrectly rewritten
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-02 11:15 EST by Alexander Pavlov CLA
Modified: 2005-02-15 12:27 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlov CLA 2005-02-02 11:15:28 EST
(3.1M4)
We have the following enum type:

public enum MyEnum {
}

Running the following code for this type,

EnumDeclaration enumDecl = ... ;
String name = "VALUE1";
EnumConstantDeclaration ecd = enumDecl.getAST().newEnumConstantDeclaration();
ecd.setName(ecd.getAST().newSimpleName(name));
ListRewrite lrw = rw.getListRewrite(enumDecl, 
EnumDeclaration.ENUM_CONSTANTS_PROPERTY);
lrw.insertFirst(ecd, null); // actually, any insert... method

and further rewriting the source code, we get the following result:

public enum MyEnumVALUE1 {
}

which is different from the correct result. The rewriting is performed properly 
if there are one or more enum constants already present in the list.
Comment 1 Martin Aeschlimann CLA 2005-02-02 13:04:28 EST
fixed > 20050202
Comment 2 Martin Aeschlimann CLA 2005-02-02 13:04:51 EST
fix released
Comment 3 David Audel CLA 2005-02-15 12:27:18 EST
Verified in I20050214-0927