Bug 82319 - [5.0][enums] Inner enums in generics and switch statement are not supported
Summary: [5.0][enums] Inner enums in generics and switch statement are not supported
Status: RESOLVED DUPLICATE of bug 81945
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: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-06 09:26 EST by Constantine Plotnikov CLA
Modified: 2005-01-11 07:12 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 Constantine Plotnikov CLA 2005-01-06 09:26:00 EST
I'm using eclipse-SDK-3.1M4-win32.zip.

Inner enums in geneneric classes are not support in the switch statement:
The sample below causes two duplicate case errors:

public class A<T> {
	public enum X { a,b }
	void foo() {
		for (X x : X.values()) {
			switch(x) {
			 case a:
			 case b:
			 	System.out.println(x.name());
			}
		}
	}
}

If "<T>" is removed, the sample starts to compile.

Workaround is to use if statements instead of switch. However it looks more ugly.
Comment 1 Jerome Lanneluc CLA 2005-01-11 07:12:02 EST

*** This bug has been marked as a duplicate of 81945 ***