Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Assume you have a class test.Foo:
package test class Foo { static foo() {'foo'} }
Let's consider some code snippets. IMHO Groovy incorrectly resolves reference 'foo' to statically imported method in all of these cases.
import static test.Foo.foo class Bar { def foo() {'bar'} class Inner { def abc() { assert foo() == 'bar' //statically imported method will be invoked here } } }
import static test.Foo.foo class Bar { def foo() {'bar'} } new Bar().with { assert foo() == 'bar' //statically imported method will be executed }
import static test.Foo.foo class Base { def foo(){'base'} } class Bar extends Base { def abc() { assert foo() == 'base' //statically imported method will be executed } }