[
https://issues.apache.org/jira/browse/GROOVY-11663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-11663:
---------------------------------
Description:
Consider the following:
{code:groovy}
package p
trait A {
public static final String BANG = '!'
}
@groovy.transform.TypeChecked
trait B extends A {
static staticMethod() {
BANG // p_A__BANG works
}
def method() {
BANG // p_A__BANG works
}
}
class C implements B {
static main(args) {
p_A__BANG // Apparent variable ... was found in a static scope but doesn't
refer to a local variable, static field or class
staticMethod()
method()
}
}
{code}
If the trait B is implemented and the methods are called, both produce
MissingMethodException. STC should catch this.
was:
Consider the following:
{code:groovy}
package p
trait A {
public static final String BANG = '!'
}
@groovy.transform.TypeChecked
trait B extends A {
static staticMethod() {
BANG // p_A__BANG works
}
def method() {
BANG // p_A__BANG works
}
}
class C implements B {
static main(args) {
staticMethod()
method()
}
}
{code}
If the trait B is implemented and the methods are called, both produce
MissingMethodException. STC should catch this.
> STC: trait extends trait and tries to use static field
> ------------------------------------------------------
>
> Key: GROOVY-11663
> URL: https://issues.apache.org/jira/browse/GROOVY-11663
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
>
> Consider the following:
> {code:groovy}
> package p
> trait A {
> public static final String BANG = '!'
> }
> @groovy.transform.TypeChecked
> trait B extends A {
> static staticMethod() {
> BANG // p_A__BANG works
> }
> def method() {
> BANG // p_A__BANG works
> }
> }
> class C implements B {
> static main(args) {
> p_A__BANG // Apparent variable ... was found in a static scope but
> doesn't refer to a local variable, static field or class
> staticMethod()
> method()
> }
> }
> {code}
> If the trait B is implemented and the methods are called, both produce
> MissingMethodException. STC should catch this.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)