From reinier at zwitserloot.com Thu Apr 16 20:32:59 2020 From: reinier at zwitserloot.com (Reinier Zwitserloot) Date: Thu, 16 Apr 2020 22:32:59 +0200 Subject: JEP 301: Enhanced Enums Message-ID: 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 { 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 { Argument 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 From forax at univ-mlv.fr Thu Apr 16 22:32:35 2020 From: forax at univ-mlv.fr (Remi Forax) Date: Fri, 17 Apr 2020 00:32:35 +0200 (CEST) Subject: JEP 301: Enhanced Enums In-Reply-To: References: Message-ID: <1361748032.501804.1587076355210.JavaMail.zimbra@u-pem.fr> 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" > ?: 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 { > 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 { > Argument 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