Release Note: C-Style Array Declarations Are Not Allowed in Record Components

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Delivered
    • Priority: P3
    • 16
    • Affects Version/s: 16
    • Component/s: tools
    • Verified

      Prior to JDK 16, the `javac` compiler accepted C-style array declarations in record components. The JLS 16 now forbids it. In particular, the compiler had accepted code such as:

      ```
          record R(int i[]) {}
      ```

      This code is no longer acceptable according to the specification for JDK 16. Section 8.10.1 of the JLS 16 defines the syntax of a record component as:

      ```
      RecordComponent:
          {RecordComponentModifier} UnannType Identifier
          VariableArityRecordComponent
      VariableArityRecordComponent:
          {RecordComponentModifier} UnannType { Annotation } ... Identifier
      RecordComponentModifier:
          Annotation
      ```
      which clearly forbids C-style array declarations in record components. To fix this issue, the compiler has been synchronized with the JLS 16, so that C-style array declarations are no longer allowed in record components.

            Assignee:
            Vicente Arturo Romero Zaldivar
            Reporter:
            Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: