Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8236623

Records: Clarify interaction between records and varargs

XMLWordPrintable

      Both of the following are accepted by the current `javac`, but probably should not be:

      ```
      record Test(int[] args) {
        public Test(int... args) {
          this.args = args;
        }
      }
      ```
      and

      ```
      record Test(int... args) {
        public Test(int[] args) {
          this.args = args;
        }
      }
      ```

      These both probably fall into the "an explicit canonical ctor should match the record descriptor exactly" bucket. There is little benefit to such divergence.

            gbierman Gavin Bierman
            briangoetz Brian Goetz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: