You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by "ocs@ocs" <oc...@ocs.cz> on 2018/09/30 22:45:44 UTC
another weird parser case
Hi there,
lately, I got bit in my tender parts by this catch, sorta similar to the debate of the more-line-expression of late -- this time, though, a line which I presumed to be compiled separately is considered a part of the previous command:
===
20 /tmp> <q.groovy
class foo {
static bar() { }
static Closure baz() {
bar()// ';' here mandatory, or a return on the next line
{ -> }
}
}
foo.baz()
21 /tmp> /usr/local/groovy-3.0.0-alpha-3/bin/groovy q
Caught: groovy.lang.MissingMethodException: No signature of method: static foo.bar() is applicable for argument types: (foo$_baz_closure1) values: [foo$_baz_closure1@ae7950d]
...
===
I am not sure whether it can be fixed without breaking other functionalities (perhaps not; note e.g., that a 'bar(Closure)' could be added through a metaclass dynamically before the call); and even if it could, whether it would be worth the effort.
All the best,
OC