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

record cannot be adjusted by @RecordType annotation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0.7
    • None
    • None

    Description

      Consider the following:

      @RecordType(defaults=false, namedVariant=false)
      record Person(String name, Date dob) {
        //Person(String,Date)
        //Person(String)  no!
        //Person(Map)     no!
        //Person()        no!
      
        public Person { // implies @TupleConstructor(pre={...})
          assert name.length() > 1
        }
      
        Person(Person that) {
          this(that.name(), that.dob())
        }
      
        //getAt(int i)
        //toList()
        //toMap()
      }
      

      The goal is to disable all the extra constructors and @RecordType fails to do so. This is because there is an implicit @RecordType() annotation added by the parser that gets in the way of correct merged attributes.

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: