Issue Details (XML | Word | Printable)

Key: GROOVY-2215
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jochen Theodorou
Reporter: Jörg Staudemeyer
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

Cannot create enum type with explicit constructor

Created: 16/Oct/07 09:39 AM   Updated: 02/Nov/07 09:10 AM
Component/s: None
Affects Version/s: 1.1-rc-1
Fix Version/s: 1.1-rc-2

Time Tracking:
Not Specified

Environment: GroovyConsole, Windows


 Description  « Hide
According to "Blackdrags View" (http://blackdragsview.blogspot.com/2007_10_01_archive.html) the following enum definition should be possible in Groovy as of rc-1:

enum E {
A(100),B(200),C(300)
def value
E (v) { value = v }
}

When I try this in GroovyConsole, I get a puzzling MultipleCompilationErrorsException:

Exception thrown: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, General error during conversion: org.codehaus.groovy.ast.expr.ConstantExpression cannot be cast to org.codehaus.groovy.ast.expr.ListExpression

I'm not sure if this is really a compilation error or if it's only a misleading message because this kind of enum might not be actually supported.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jochen Theodorou added a comment - 02/Nov/07 09:10 AM
fixed