Details
-
Sub-task
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.4
-
None
-
None
Description
In the case described below, there is a bug in how static imports and local methods are resolved when using an implied property setter (i.e., xxx.var1 = 8).
Peter Niederwieser reduced the initial test case to the one here:
Utility.groovy
class Utility { static One method1(int a) { println "Utility.method1" return new One() } static One method2(One o) { println "Utility.method2" return o } }
Harness.groovy
import static Utility.* class Harness { def method1() { println "Harness.method1" return new One() } def run() { method2(method1()).var1 = 8 } static main(args) { new Harness().run() } } class One { def var1 }
With Groovy 1.7.3:
groovy Harness Harness.method1 Caught: groovy.lang.MissingMethodException: No signature of method: static Utility.method1() is applicable for argument types: (One) values: [One@5dc1ac46] Possible solutions: method1(int), method2(One) at Harness.run(Harness.groovy:10) at Harness.main(Harness.groovy:14)
With Groovy Trunk:
Harness.method1 Caught: groovy.lang.MissingMethodException: No signature of method: Harness.method2() is applicable for argument types: (One) values: [One@45cbda0a] Possible solutions: method1() at Harness.run(Harness.groovy:10) at Harness.main(Harness.groovy:14)