Community
Participate
Working Groups
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...
Actually, specs reject it. Closing
PRODUCT VERSION: 113