Extending 15.28 to include toString() on an enum constant

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Jul 9 08:52:11 UTC 2018


Remi is correct - 303 has the potential to special case toString() 
method calls on enums. One thing that 303 lacks, at least at the moment, 
is the ability to redefine what goes into places where a constant 
expression is expected (case labels, annotations, ...). That is, the 
additional constant propagation occurs *after* type-checking, and it's 
mostly there to support code generation. What you ask would have an 
impact on the language frontend (and would therefore require some spec 
text for it) - I'm unsure as to whether this falls within the scope of 303.

Maurizio


On 09/07/18 07:39, Remi Forax wrote:
> JEP 303 (http://openjdk.java.net/jeps/303) allows to build such kind of constants, i don't know if it works in the context of annotations but it's a nice use case.



More information about the amber-spec-experts mailing list