Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.6
-
None
-
Mac OS X 10.6.6
IntelliJ 10.0.1
Description
In Java you can define abstract methods for an enum type to override it with a concrete method in a constant-specific class body (see Effective Java, 2nd Ed., page 152). When I try to do the same in Groovy I get a compilation error:
Can't have an abstract method in a non-abstract class. The class 'Day' must be declared abstract or the method 'java.lang.String getAction()' must be implemented.
This compilation error can be reproduced with this enum:
enum Day { SUNDAY { String getAction() { 'Relax' } }, MONDAY { String getAction() { 'Work' } } abstract String getAction() }
An enum in Groovy should provide the same behavior for enums as Java.