PROPOSAL: Abstract enums (version 2)

Bruce Chapman brucechapman at paradise.net.nz
Fri May 1 03:25:44 PDT 2009


Howard Lovatt wrote:
> Derek,
>
> I have found also wanted to extend an abstract class when using enums.
> However I ideally didn't want to extend a special enum abstract class, e.g.
>
> abstract enum Super { ... } // Has enum
>
> enum extends Super { ... }
>
> But rather any old abstract class:
>
> abstract class Super { ... } // No enum
>
> enum extends Super { ... }
>
> What is the rational for only allowing abstract enum to be extended rather
> than a plain abstract class.
>   
Because if an enum could extend any abstract class, then it wouldn't 
always be possible to also extend java.lang.Enum<E extends Enum<E>>, and 
the language spec says (currently) "The direct superclass of an enum 
type named /E/ is |Enum<E>"|, and Enum's class apidoc says "This is the 
common base class of all Java language enumeration types."

Bruce
>  -- Howard.
>
>   




More information about the coin-dev mailing list