Bug 95480 - [model] Missing INVALID_SIBLING exception when creating a type in an enum type that contains constants
Summary: [model] Missing INVALID_SIBLING exception when creating a type in an enum typ...
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.5 M1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-16 18:17 EDT by Olivier Thomann CLA
Modified: 2008-08-06 13:43 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix and regression test (2.52 KB, patch)
2008-06-12 09:37 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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