Bug 3298 - Incorrect compile error on valid case statement (1GEYWET)
Summary: Incorrect compile error on valid case statement (1GEYWET)
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 22:52 EDT by Philipe Mulet CLA
Modified: 2002-01-11 09:08 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 Philipe Mulet CLA 2001-10-10 22:52:48 EDT
Gary Karasiuk noticed this but does not have RPRS access.  He wrote:
The Java compiler in build 113 is generating an error message "case expression must be constant expression" when
the expression is a static final short.  This compiles and runs fine under 1.2.2 but generates the above error when run in Eclipse.

He provided the following test files:
	karasiuk/play/Node.java
		package karasiuk.play;
		public class Node
		{
		       public static final short THREE = 3;
		}
	karasiuk/play/Test.java
		package karasiuk.play;
		public class Test
		{
		       public static void main(String[] args)
		       {
		               System.out.println("In test");
		               Node node = new Node();
		               switch (3)
		               {       case node.THREE:
		                               System.out.println("Found 3");
		                               break;
		                       default:
		                               System.out.println("Did not find three");
		               }
		               System.out.println("End of test");
		       }
		}

NOTES:
EG (6/7/2001 10:37:25 AM)
	moving to JCORE

JW (6/7/01 8:57:15 PM) This is actually a defect in the jdk 1.2.2 compiler.  This defect has been fixed in jdk 1.3.

PM (6/8/2001 11:37:41 AM)
	Need to investigate, the second edition specs seem to allow this...
Comment 1 Philipe Mulet CLA 2001-10-24 06:24:28 EDT
Actually, specs reject it. Closing
Comment 2 DJ Houghton CLA 2001-10-29 17:07:49 EST
PRODUCT VERSION:
113