PROPOSAL: Abstract enums (version 2)
howard.lovatt at gmail.com
howard.lovatt at gmail.com
Sun May 3 22:18:04 PDT 2009
I probably worded my question badly, sorry. I was aware that Enum was the
base class for enums. What I was asking is why does it have to be the base
class.
Why can't Enum be turned into an interface and the methods added by the
compiler automatically. This would be a smaller change than adding a new
type, abstract enum, to the type system and would be more useful?
On May 1, 2009 6:38pm, Bruce Chapman <brucechapman at paradise.net.nz> wrote:
> 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, eg
> 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 Enum>, and the language
> spec says (currently) "The direct
> superclass of an enum type named E is Enum",
> and Enum's class apidoc says "This is the common base class of all Java
> language enumeration types."
> Bruce
> -- Howard.
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
More information about the coin-dev
mailing list