[records] Is C-style array declaration in components dropped?
Tagir Valeev
amaembo at gmail.com
Fri Jul 24 03:55:13 UTC 2020
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
More information about the amber-spec-experts
mailing list