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 Mon, 27 Mar 2017 14:24:42 GMT

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

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

GitHub user shils opened a pull request:

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

    GROOVY-8132: Owner properties should be preferred over properties of …

    …@Delegate field
    
    * Add test for method delegation precedence

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shils/groovy GROOVY-8132

Alternatively you can review and apply these changes as the patch at:

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

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #518
    
----
commit aaed13450e688815c376a7b351a50c0f9ba55394
Author: Shil Sinha <shil.sinha@gmail.com>
Date:   2017-03-22T17:26:24Z

    GROOVY-8132: Owner properties should be preferred over properties of @Delegate field
    * Add test for method delegation precedence

----


> 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