Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8250629 do not allow C-style array declaration in record components
  3. JDK-8260739

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

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: P3
    • Resolution: Delivered
    • Affects Version/s: 16
    • Fix Version/s: 16
    • Component/s: tools
    • Labels:

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: