Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.1-rc-1
-
Fix Version/s: 1.1-rc-2
-
Component/s: None
-
Labels:None
-
Environment:Windows 2000
Groovy Version: 1.1-rc-1
JVM: 1.6.0_02-b05
-
Number of attachments :
Description
The following code snippet can not be run, but after I used the full name such as Fruit.APPLE, Fruit.ORANGE, Fruit.BANANA, the code can be run successfully.
public enum Fruit { APPLE, ORANGE, BANANA } Fruit f = Fruit.BANANA println f switch (f) { case APPLE: println "Apple" break case ORANGE: println "Orange" break case BANANA: println "Banana" break default: println "Will not reach!" break }
Indeed. Not only does Java allow the class name to be dropped, it requires it: