#2265 Deprecated enum values

SlimerDude Wed 16 Apr 2014

You don't seem able to deprecate enum values:

enum class Example {
  @Deprecated wotever;  // --> Compilation Err: Expected identifier, not '@'
}

Is this by design?

brian Thu 17 Apr 2014

I can see the utility, but adding facets on each enum item isn't really baked into the design today. Does Java support attributes on enum items?

SlimerDude Thu 17 Apr 2014

StackOverflow says, "Yes!", Java does:

enum Status {
    OK,
    ERROR,

    /**
     * @deprecated Use ERROR instead.
     */
    @Deprecated
    PROBLEM
}

Not that I care much about what Java does nowadays...

brian Thu 17 Apr 2014

Promoted to ticket #2265 and assigned to brian

Okay, it makes sense that we should support that

brian Thu 8 Jan 2015

Ticket resolved in 1.0.67

The compiler has been enhanced to support facets on individual enum item fields (the enumDef production in the grammar). Also made some tweaks so that you can deprecate an individual enum item and not receive spurious warnings on the enum class itself.

Login or Signup to reply.