Bug 82319

Summary: [5.0][enums] Inner enums in generics and switch statement are not supported
Product: [Eclipse Project] JDT Reporter: Constantine Plotnikov <cap>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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 ***