groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-8132) Properties of @Delegate fields are preferred to those in the owning class
Date Sat, 15 Apr 2017 20:58:42 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-8132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15970144#comment-15970144
] 

ASF GitHub Bot commented on GROOVY-8132:
----------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/groovy/pull/518


> Properties of @Delegate fields are preferred to those in the owning class
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-8132
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8132
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.10
>            Reporter: Shil Sinha
>            Assignee: Shil Sinha
>
> Example:
> {code}
> class Foo {
>     String pls
>     @groovy.lang.Delegate
>     Bar bar
> }
> class Bar { 
>     String pls        
> }
> assert new Foo(pls: 'ok').pls == 'ok'
> {code}
> Running the code above results in the following exception:
> {code}
> java.lang.NullPointerException: Cannot set property 'pls' on null object
> {code}
> Delegation of properties should behave the the same way as delegation of methods i.e.
properties of delegates should not take precedence over properties declared in the owning
class.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message