Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10305

Groovy records do not allow creating non-compact constructors with signature matching the record one

    XMLWordPrintableJSON

Details

    Description

      The following code

      record X(int a) {
          public X(int a) {
              println "abcd"
          }
      }
      
      def x = new X(10)

       

      fails to run with an exception "java.lang.ClassFormatError: Duplicate method name "<init>" with signature "(I)V" in class file X". Similar code in java works fine.

      Attachments

        Activity

          People

            daniel_sun Daniel Sun
            knisht Konstantin Nisht
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: