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

    • Sub-task
    • Resolution: Delivered
    • P3
    • 16
    • 16
    • tools
    • Verified

    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

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

            Dates

              Created:
              Updated:
              Resolved: