There seems to be a problem with enum inside a class (in 1.7.0). In the
following example
class EnumTest2 {
enum Direction { North, East, South, West }
static void main(args) {
for (d in Direction) {
println d
}
}
}
An exception is thrown:
Caught: groovy.lang.MissingMethodException: No signature of method:
static EnumTest2$Direction.values() is applicable for argument types: ()
values: []
If I move the enum outside the class to its own file, the same code
works fine.
Cheers,
Xiaoping
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
I don't know that that would have ever worked in Groovy. Groovy does not support nested classes. Instead, you can define multiple classes in the same source file, no nesting, like you are forced to do with Java.
What you did to fix the issue is what I would expect to be done.
David Weiler-Thiessen
Nestlé Purina PetCare
phone: 306-933-0232
cell: 306-291-9770
This e-mail, its electronic document attachments, and the contents of its website linkages may contain confidential information. This information is intended solely for use by the individual or entity to whom it is addressed. If you have received this information in error, please notify the sender immediately and promptly destroy the material and any accompanying attachments from your system.
Anonymous Inner Classes and Nested Classes are added to 1.7 and enum
inside a class also works to some extent, except when values() of the
enum is needed like in the example.
Cheers,
Xiaoping
On Thu, 2010-01-07 at 10:55 -0600,
I learned something new today :-)
Xiaoping