Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 80115 - Enums are not supported in switch
Summary: Enums are not supported in switch
Status: RESOLVED DUPLICATE of bug 77430
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-03 10:51 EST by Constantine Plotnikov CLA
Modified: 2004-12-03 10:59 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 2004-12-03 10:51:54 EST
I'm using eclipse-SDK-I20041201-win32.zip.

Enumerations are not suported for switch statements. The following code 
compiles without errors under JDK 1.5, but produces the following errors under
Eclipse.

Severity	Description	Resource	In Folder	Location	
2	a cannot be resolved	TestClass.java	test/test	line 12
2	b cannot be resolved	TestClass.java	test/test	line 15
2	c cannot be resolved	TestClass.java	test/test	line 18


------------- test/TestClass ------------------
package test;
public class TestClass {
	State state = State.a;
	public enum State {
		a,
		b,
		c;
	}
	public static void main() {
		TestClass o = new TestClass();
		switch(o.state) {
		case a:
			System.out.println("A");
			break;
		case b:
			System.out.println("B");
			break;
		case c:
			System.out.println("C");
			break;
		}
	}
}
Comment 1 Olivier Thomann CLA 2004-12-03 10:59:02 EST

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