[records] Is C-style array declaration in components dropped?

Brian Goetz brian.goetz at oracle.com
Fri Jul 24 12:43:41 UTC 2020

As we've added new places or ways to declare variables (e.g., var, 
record components), we've been trying to not propagate this syntax 
mistake.  So I agree that this is the right behavior; I think the change 
just got lost in the shuffle.

On 7/23/2020 11:55 PM, Tagir Valeev wrote:
> Hello!
> The JLS 14 record preview spec allows C-style array declaration in
> components (like record R(int x[])) [1]:
> RecordComponent:
>    { VariableModifier } UnannType VariableDeclaratorId
>    VariableArityRecordComponent
> VariableDeclaratorId:
>    Identifier [ Dims ]
> However, it appears that JLS 15 draft spec doesn't allow it anymore [2]
> RecordComponent:
>    { Annotation } UnannType Identifier
>    VariableArityRecordComponent
> This change is not listed in the draft spec prolog in "The changes are
> the same as those in the first preview of Records in Java SE 14,
> except for the following", so I overlooked it when updated the records
> support in IntelliJ IDEA. Is this intended change? If yes, then
> probably the changes section should be updated to include it as well.
> I must say that I heavily support this change. Supporting C-style
> array declaration in records adds complexity in many places of our
> codebase and introduces subtle bugs. It's somewhat depressing to fix
> all of them, knowing that nobody would use this anyway.
> With best regards,
> Tagir Valeev.
> [1] https://docs.oracle.com/javase/specs/jls/se14/preview/specs/records-jls.html#jls-8.10.1
> [2] http://cr.openjdk.java.net/~gbierman/jep384/jep384-20200506/specs/records-jls.html#jls-8.10.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20200724/ae8c1b85/attachment.htm>

More information about the amber-spec-experts mailing list