Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.0
-
Fix Version/s: 1.7.1, 1.8-beta-1
-
Component/s: None
-
Labels:None
-
Environment:Mac OS X
-
Number of attachments :
Description
enum Color { RED { { println("foo"); } // Instance initalizer },GREEN,BLUE }
makes an error like:
$ groovy enumtest.groovy org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: /Users/uehaj/src/groovy/enumtest.groovy: -1: You are not allowed to overwrite the final method $INIT([Ljava.lang.Object;) from class 'Color'. @ line -1, column -1. 1 error
following is OK.
num Color {
RED {
String toString() {}
{ println("foo"); } // Instance initalizer
},GREEN,BLUE
}