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

Eric Milles resolved GROOVY-9678.
---------------------------------
    Resolution: Fixed

Works in current Groovy 2.5+

> traits: add support for static property notation in static contexts
> -------------------------------------------------------------------
>
>                 Key: GROOVY-9678
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9678
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Priority: Minor
>
> Bean-style references to static trait property in static scopes fail with 
> unresolved variable errors.
> This works:
> {code:groovy}
> trait T {
>   static p = 1
> }
> class C implements T {
>   static m() {
>     setP(2)
>     setP(getP() + 1)
>     return getP()
>   }
> }
> C.m()​
> {code}
> This fails:
> {code:groovy}
> trait T {
>   static p = 1
> }
> class C implements T {
>   static m() {
>     p = 2 // Apparent variable 'p' was found in a static scope but doesn't 
> refer to a local variable, static field or class
>     p += 1
>     return p
>   }
> }
> C.m()​
> {code}



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

Reply via email to