You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/08/08 19:47:00 UTC
[jira] [Created] (GROOVY-9678) traits: add support for static
property notation in static contexts
Eric Milles created GROOVY-9678:
-----------------------------------
Summary: 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
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)