[
https://issues.apache.org/jira/browse/GROOVY-10200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-10200:
---------------------------------
Description:
Similar to GROOVY-9678, bean-style property accesses in static inner class may
be improperly flagged as an unresolved static reference. Consider the
following:
{code:groovy}
class A {
def getB() {
'works'
}
}
class C {
@Mixin(A)
static class D {
void test() {
println b
}
}
}
new C.D().test()
{code}
Access to mixin method "getB()" through the variable expression is flagged with
"Apparent variable 'b' was found in a static scope but doesn't refer to a local
variable, static field or class." If "b" is written as "getB()" or "this.b"
the script compiles and executes as expected.
was:
Similar to GROOVY-9678, bean-style property accesses in static inner class may
be improperly flagged as a static reference. Consider the following:
{code:groovy}
class A {
def getB() {
'works'
}
}
class C {
@Mixin(A)
static class D {
void test() {
println b
}
}
}
new C.D().test()
{code}
Access to mixin method "getB()" through the variable expression is flagged with
"Apparent variable 'b' was found in a static scope but doesn't refer to a local
variable, static field or class." If "b" is written as "getB()" or "this.b"
the script compiles and executes as expected.
> Static scope error for variable in non-static method of static inner class
> --------------------------------------------------------------------------
>
> Key: GROOVY-10200
> URL: https://issues.apache.org/jira/browse/GROOVY-10200
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.5.14, 3.0.8, 4.0.0-alpha-3
> Reporter: Eric Milles
> Priority: Minor
>
> Similar to GROOVY-9678, bean-style property accesses in static inner class
> may be improperly flagged as an unresolved static reference. Consider the
> following:
> {code:groovy}
> class A {
> def getB() {
> 'works'
> }
> }
> class C {
> @Mixin(A)
> static class D {
> void test() {
> println b
> }
> }
> }
> new C.D().test()
> {code}
> Access to mixin method "getB()" through the variable expression is flagged
> with "Apparent variable 'b' was found in a static scope but doesn't refer to
> a local variable, static field or class." If "b" is written as "getB()" or
> "this.b" the script compiles and executes as expected.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)