Bug 95480

Summary: [model] Missing INVALID_SIBLING exception when creating a type in an enum type that contains constants
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: frederic_fusier
Version: 3.1   
Target Milestone: 3.5 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix and regression test none

Description Olivier Thomann CLA 2005-05-16 18:17:22 EDT
When using the UI to create a new type inside an enum type that contains some
enum constants, an IllegalArgumentException is thrown. See bug 94304.
The problem comes from the fact that an enum constant is seen as a valid sibling
for the new type.
This should indeed be an invalid sibling and there is a corresponding java model
status for that.
The same problem should apply for createField or createMethod if the sibling is
an enum constant declaration.
Right now it is not possible to create an enum constant declaration using the
APIs on IType. Therefore an enum constant declaration is always an invalid sibling.
Comment 1 Frederic Fusier CLA 2007-06-19 07:15:44 EDT
Reproduced with 3.3 RC4
Comment 2 Jerome Lanneluc CLA 2007-06-20 12:17:07 EDT
To reproduce, first undo the fix from bug 94304 comment 9.
Comment 3 Jerome Lanneluc CLA 2008-05-07 07:58:18 EDT
The bug is still there. However people should now use ASTRewrite to modify the source. This makes this bug less important.
Deferring post 3.4
Comment 4 Jerome Lanneluc CLA 2008-06-12 09:37:25 EDT
Created attachment 104673 [details]
Proposed fix and regression test
Comment 5 Jerome Lanneluc CLA 2008-06-25 12:49:34 EDT
Fix and test released for 3.5M1
Comment 6 Olivier Thomann CLA 2008-08-06 13:43:24 EDT
Verified for 3.5M1 using I20080805-1307