Bug 26652

Summary: Encountered "case statement must be constant" error
Product: [Eclipse Project] JDT Reporter: Missing name <yasuday>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: fuse
Version: 2.0.2   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Missing name CLA 2002-11-19 06:27:07 EST
When migrating the java file which includes the case statement, created by 
VAJ4.0, I encountered an error "case statement must be constant".
The test program is a real customer's data, so I cannot attach it in bugzilla.
Please contact me off-line and I will send it.
Comment 1 Sonia Dimitrov CLA 2002-11-19 09:23:22 EST
Moving to JDT Core.
Comment 2 Philipe Mulet CLA 2002-11-20 09:31:02 EST
We did fix a couple cases where our compiler was too permissive. 

In particular, expressions denoting constants through a non-static references 
were incorrectly allowed. 

e.g.

public class X {
	public final static int CST = 1;
	public static void main(String[] arguments) {
		X x = new X();
		switch (1) {
			case x.CST : 
				break;
		}
	}
}

"case x.CST" should be replaced with "case X.CST" or simply "case CST" where it 
applies.

Ok to close? Or is your scenario different from this one ?
Comment 3 Philipe Mulet CLA 2002-11-21 05:35:33 EST
Closing, please reopen if you have a test case which we reject incorrectly.