You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/11/23 00:40:00 UTC

[jira] [Updated] (GROOVY-10854) record cannot be adjusted by @RecordType annotation

     [ https://issues.apache.org/jira/browse/GROOVY-10854?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-10854:
---------------------------------
    Fix Version/s: 4.0.7

> record cannot be adjusted by @RecordType annotation
> ---------------------------------------------------
>
>                 Key: GROOVY-10854
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10854
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 4.0.7
>
>
> Consider the following:
> {code:groovy}
> @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()
> }
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)