Bug 85298 - [1.5][enum] IType of anonymous enum declaration says isLocal() == false
Summary: [1.5][enum] IType of anonymous enum declaration says isLocal() == false
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.2 M3   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-15 12:42 EST by Markus Keller CLA
Modified: 2011-03-10 06:23 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-02-15 12:42:25 EST
I20050215-0800

enum Col {
	RED, BROWN(), GREEN(){};
}

The IType of the anonymous enum declaration (the child of the IField 'GREEN')
says isLocal() == false. I would expect to get true here.
Comment 1 Olivier Thomann CLA 2005-02-17 12:16:50 EST
The local type inside the outline is hidden when I filter out local types. So
why do you say that the type is not local?
Comment 2 Markus Keller CLA 2005-02-17 13:38:19 EST
The local types filter (MemberFilter#isLocalType(IType)) does not query
#isLocal(), but checks whether an IType's parent is a non-IType IMember.

I found the bug when trying to delete an anonymous enum from the outline view:
- set a breakpoint in ASTNodeDeleteUtil 1.17, line 45
- delete the enum "{...}" from the outline view
Comment 3 Jerome Lanneluc CLA 2005-10-17 12:28:07 EDT
Changed SourceType#isLocal() to handle the case where the parent is an IField.
Added regression test LocalElementTests#testAnonymousType6().
Comment 4 Olivier Thomann CLA 2005-10-28 11:27:36 EDT
Verified for 3.2 M3 using build I20051025-0800+JDT/Core v_618a
Comment 5 Jay Arthanareeswaran CLA 2011-03-10 06:23:10 EST
See bug 339337, comment #2.

The JLS §14.3 says this: "A local class is a nested class (§8)  that is not a member of any class and that has a name."

And the example given in comment #0 seems satisfy this condition. Should it still be considered a local type?