You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2021/03/22 08:31:00 UTC

[jira] [Updated] (GROOVY-9993) CLONE - A field and a property with the same name aren't flagged as a duplicate

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

Paul King updated GROOVY-9993:
------------------------------
    Description: 
Two fields or two properties with the same name cause compilation to fail but the following script passes (showing that the backing field has precedence) but should not compile:
{code}
class X {
    protected x
    def x = 3
}

new X().x // => null
{code}


  was:
Two fields or two properties with the same name cause compilation to fail but the following script passes (showing that the backing field has precedence) but should not compile:
{code}
class HasDate {
  Date d = new Date()
  private Date d = null
}

assert !new HasDate().d
{code}



> CLONE - A field and a property with the same name aren't flagged as a duplicate
> -------------------------------------------------------------------------------
>
>                 Key: GROOVY-9993
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9993
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>              Labels: breaking
>             Fix For: 4.0.0-alpha-3
>
>
> Two fields or two properties with the same name cause compilation to fail but the following script passes (showing that the backing field has precedence) but should not compile:
> {code}
> class X {
>     protected x
>     def x = 3
> }
> new X().x // => null
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)