<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>De: </b>"Maurizio Cimadamore" <maurizio.cimadamore@oracle.com><br><b>À: </b>"Brian Goetz" <brian.goetz@oracle.com>, "Tagir Valeev" <amaembo@gmail.com>, "amber-spec-experts" <amber-spec-experts@openjdk.java.net><br><b>Envoyé: </b>Vendredi 18 Septembre 2020 17:23:35<br><b>Objet: </b>Re: [records] Is C-style array declaration in components dropped?<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><p>+1 on this - as Brian says - part of a long-term battle against old syntax - note that at some point in Java 7 we dropped support for C-style array syntax on varargs decl - e.g.:</p><p>void m(int n, String... args[])</p><p>See:<br><a class="moz-txt-link-freetext" href="https://bugs.openjdk.java.net/browse/JDK-6569633" target="_blank" rel="noopener" data-mce-href="https://bugs.openjdk.java.net/browse/JDK-6569633">https://bugs.openjdk.java.net/browse/JDK-6569633</a><br></p><p>Maurizio</p></blockquote><div><br></div><div>The real offender is still at large :)<br></div><div><br data-mce-bogus="1"></div><div>class Foo {<br data-mce-bogus="1"></div><div> String f() [] { return null; }<br data-mce-bogus="1"></div><div>}<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Rémi<br data-mce-bogus="1"></div><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><p><br></p><div class="moz-cite-prefix">On 24/07/2020 13:43, Brian Goetz wrote:<br></div><blockquote cite="mid:29901fcd-8dc5-55d6-466e-4f58903865eb@oracle.com"><span style="font-size: xx-small;"><tt>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. </tt></span><br><br><div class="moz-cite-prefix">On 7/23/2020 11:55 PM, Tagir Valeev wrote:<br></div><blockquote cite="mid:CAE+3fjbu7NSeM5pa3uj0EGUwocOiZUc8-rAuJu+2=G6-EMe_eg@mail.gmail.com"><pre class="moz-quote-pre">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] <a class="moz-txt-link-freetext" href="https://docs.oracle.com/javase/specs/jls/se14/preview/specs/records-jls.html#jls-8.10.1" target="_blank" rel="noopener" data-mce-href="https://docs.oracle.com/javase/specs/jls/se14/preview/specs/records-jls.html#jls-8.10.1">https://docs.oracle.com/javase/specs/jls/se14/preview/specs/records-jls.html#jls-8.10.1</a>
[2] <a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~gbierman/jep384/jep384-20200506/specs/records-jls.html#jls-8.10.1" target="_blank" rel="noopener" data-mce-href="http://cr.openjdk.java.net/~gbierman/jep384/jep384-20200506/specs/records-jls.html#jls-8.10.1">http://cr.openjdk.java.net/~gbierman/jep384/jep384-20200506/specs/records-jls.html#jls-8.10.1</a>
</pre></blockquote><br></blockquote><br></blockquote></div></div></body></html>