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

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.0.0-beta-1
    • None
    • Compiler

    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

            Unassigned Unassigned
            knisht Konstantin Nisht
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: