PROPOSAL: Abstract enums (version 2)

David Walend david at walend.net
Sun May 17 16:45:42 PDT 2009


On May 13, 2009, at 2:53 AM, coin-dev-request at openjdk.java.net wrote:
> Date: Wed, 13 May 2009 10:35:17 +1000
> From: Howard Lovatt <howard.lovatt at iee.org>
> Subject: Re: PROPOSAL: Abstract enums (version 2)
>
> On a pragmatic point, I doubt if the proposal will go anywhere since
> no one is supporting it except me :( The point you make about wanting
> to change from a singleton to a number of instances in the future
> might be valid, but I haven't personally had this problem in using
> Scala and I haven't heard of others having problems in Scala.
>
> The main enhancement I would find useful is to be able to extend an
> arbitrary abstract class when making an enum. The present proposal of
> a special abstract enum wouldn't help my use cases much. Therefore I
> don't thing the Singleton variation is that important.


Howard,

I'll speak for enumerations extending abstract classes. It comes up  
every forth project or so for me; machine-readable JMX notifications  
come to mind. A lot of general purpose abstract classes should only be  
used certain ways within a particular context. Sometimes those ways  
fit an enum well. With the current limitation, I have to extend the  
abstract class, then create an enum full of pass-through methods. It's  
uninteresting boilerplate, and labor to maintain. I'd use enums this  
way occasionally if it were part of JDK7.

Dave



More information about the coin-dev mailing list