RFR: JDK-8236598: javac rejects record component with 'final' modifier
Paul Sandoz
paul.sandoz at oracle.com
Thu Jan 2 20:30:40 UTC 2020
> On Jan 2, 2020, at 12:17 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>
> ----- Mail original -----
>> De: "Paul Sandoz" <paul.sandoz at oracle.com>
>> À: "Vicente Romero" <vicente.romero at oracle.com>
>> Cc: "compiler-dev" <compiler-dev at openjdk.java.net>
>> Envoyé: Jeudi 2 Janvier 2020 20:46:31
>> Objet: Re: RFR: JDK-8236598: javac rejects record component with 'final' modifier
>
>> If you allow redundant declaration of “final” would the same reasoning apply to
>> “private”?
>>
>> I notice the spec does not specify an optionally private modifier but does
>> declare that the associated implicit field is private.
>>
>> It feels inconsistent. Did you consider the opposite direction and change the
>> spec?
>>
>> Paul.
>
> Hi Paul,
> the keywords apply on the record components, not on the generated fields.
> Given a record component is always accessible if the class itself is accessible, "private" makes no sense in that case.
>
Ah, I see, thanks, it’s easy to fall into the trap of field rather than component.
Paul.
> And about allowing final or not ?
> I don't know.
>
> Rémi
>
>>
>>> On Jan 2, 2020, at 10:41 AM, Vicente Romero <vicente.romero at oracle.com> wrote:
>>>
>>> Hi,
>>>
>>> Please review a simple fix to a bug in the records code. Basically the spec
>>> allows record components to redundantly declare the `final` modifier. The
>>> current implementation is not allowing this. This patch is fixing this issue.
>>>
>>> Thanks,
>>> Vicente
>>>
>>> http://cr.openjdk.java.net/~vromero/8236598/webrev.00/
>>> https://bugs.openjdk.java.net/browse/JDK-8236598
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20200102/96722874/attachment-0001.htm>
More information about the compiler-dev
mailing list