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

Liam Miller-Cushon cushon at google.com
Thu Apr 9 19:16:58 UTC 2020


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> 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> 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/61aae84f/attachment.htm>


More information about the compiler-dev mailing list