Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8-rc-1
-
None
-
None
-
Ubuntu 10.10 Maverick Meerkat, Groovy trunk 2011-03-05T08:00+00:00
Description
Attached are three small code examples. One shows that Groovy captures variables fine when using anonymous class creation using new when the expression is part of an assignment. The second shows that using an as expression also enable proper capture of variables when an expression is the return value used in a collect expression. The third shows the failure of Groovy to "do the right thing" in the case of using a new expression in a collect expression. The error returned is:
Caught: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: fails$1(fails, java.lang.Integer)
at fails$_run_closure1.doCall(fails.groovy:15)
at fails.run(fails.groovy:14)
Current hypothesis is that the fact that the function is (necessarily) called call may be a factor.