Summary
The Records spec for JDK 16 does not allow C-style array declarations in record components. The javac compiler should be sync'ed with the spec.
Problem
The javac compiler accepts C-style array declarations in record components while the specification for records forbids it. The compiler is accepting code like:
record R(int i[]) {}
which is not acceptable according to the Records specification for JDK 16
Solution
Sync the javac compiler with the specification.
Specification
Section 8.10.1 of the Record specification for JDK 16 defines the syntax of a record component as:
RecordComponent:
{ Annotation } UnannType Identifier
VariableArityRecordComponent
VariableArityRecordComponent:
{ Annotation } UnannType { Annotation } ... Identifier
which clearly forbids C-style array declarations in record components
- csr of
-
JDK-8250629 do not allow C-style array declaration in record components
-
- Resolved
-