JEP 301: Enhanced Enums

Remi Forax forax at univ-mlv.fr
Thu Apr 16 22:32:35 UTC 2020


Hi Reiner,
this JEP is dormant,
you can find some emails on amber-dev of Maurizio explaining why it can not be implemented in a backward compatible way.

Rémi

----- Mail original -----
> De: "Reinier Zwitserloot" <reinier at zwitserloot.com>
> À: platform-jep-discuss at openjdk.java.net
> Envoyé: Jeudi 16 Avril 2020 22:32:59
> Objet: JEP 301: Enhanced Enums

> I'm not sure if this mailing list is still alive, or for that matter, if
> JEP301 is still alive.
> 
> A quick note on JEP301: The syntax proposal in the JEP[1] is as follows:
> 
> enum Argument<X> {
>   STRING<String>(String.class);
> }
> 
> 
> One alternative concern that comes up: The same concern that was addressed
> by this java language change:
> 
> class Example {
>   public void foo(Example this) {}
> }
> 
> As I understand it, the point is to allow annotating the receiver. In that
> vein, it would be consistent if you can do the same with enum constants.
> The syntax would then presumably be:
> 
> enum Argument<X> {
>   Argument<String> STRING(String.class);
> }
> 
> 
> in other words, you can put the type of the 'field' in front, but that is
> optional. It obviously wouldn't be if generics are involved, but one thing
> is not related to the other. This would be legal:
> 
> 
> enum Rank {
>   Rank HEARTS,
>   CLUBS,
>   com.foo. at SomeAnnotation Rank SPADES
> }
> 
> I have no real contributions on the topic of how useful such a feature
> would be. Merely pointing out that the `void foo(SelfType this)` feature
> exists.
> 
> [1] https://openjdk.java.net/jeps/301
>  --Reinier Zwitserloot


More information about the platform-jep-discuss mailing list