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

Daniel Sun reassigned GROOVY-3056:
----------------------------------

    Assignee: Daniel Sun

> Cannot override getter of property starting with "_" using ExpandoMetaClass
> ---------------------------------------------------------------------------
>
>                 Key: GROOVY-3056
>                 URL: https://issues.apache.org/jira/browse/GROOVY-3056
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 1.5.6
>            Reporter: Peter Ledbrook
>            Assignee: Daniel Sun
>            Priority: Major
>         Attachments: ExpandoMetaClassUnderscoreTests.groovy
>
>
> For most properties you can use code like this to override property read 
> access:
> {code}
> MyClass.metaClass.getMyProp = {-> return "New value" }
> {code}
> Groovy's {{getProperty()}} method will then call the above code so objects of 
> class {{MyClass}} will appear to have the new value for that property. 
> However, if the property starts with an underscore, this behaviour breaks 
> down:
> {code}
> MyClass.metaClass.get_ajax = {-> return "Some value" }
> {code}
> The above method will not be called if one uses {{getProperty("_ajax")}}. 
> Test case attached.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to