RFR: JDK-8241798: Allow enums to have more constants

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Apr 9 21:12:20 UTC 2020


Ah - ok; thanks for the clarification. Looks good - minor nit is that 
I'd prefer to see "$" instead of "#" for the synthetic name char, in 
sync with other similar comments.

Thanks
Maurizio

On 09/04/2020 20:16, Liam Miller-Cushon wrote:
> The comment should have used 'synthetic' consistently for both the 
> method and the field, but I don't think the method was incorrect? I 
> updated it to:
>
> synthetic private static T[] #values() { return new T[] { a, b, c }; }
> synthetic private static final T[] #VALUES = #values();
>
> Note that method is the private helper that creates the array whose 
> name is prefixed with syntheticNameChar. It's not the public 
> non-synthetic values method:
>
> public static T[] values() { return $VALUES; }
>
> I uploaded another version of the patch that cleans up the comment a 
> bit. I also extracted a helper for the logic that ensures we get fresh 
> names for the synthetic members:
>
> http://cr.openjdk.java.net/~cushon/8241798/webrev.03/
>
> On Thu, Apr 9, 2020 at 3:15 AM Maurizio Cimadamore 
> <maurizio.cimadamore at oracle.com 
> <mailto:maurizio.cimadamore at oracle.com>> wrote:
>
>     In the comment, isn't "synthetic" in the wrong place?
>
>     Maurizio
>
>     On 06/04/2020 23:55, Liam Miller-Cushon wrote:
>>     On Wed, Apr 1, 2020 at 3:13 AM <forax at univ-mlv.fr
>>     <mailto:forax at univ-mlv.fr>> wrote:
>>
>>         You have forgotten to update the corresponding comment
>>
>>
>>     Thanks again, fixed:
>>     http://cr.openjdk.java.net/~cushon/8241798/webrev.02/jdk.patch
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20200409/c49abf51/attachment.htm>


More information about the compiler-dev mailing list