You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "James Kleeh (JIRA)" <ji...@apache.org> on 2017/07/31 22:33:00 UTC

[jira] [Created] (GROOVY-8274) methodMissing not executed when the delegate is an inner class

James Kleeh created GROOVY-8274:
-----------------------------------

             Summary: methodMissing not executed when the delegate is an inner class
                 Key: GROOVY-8274
                 URL: https://issues.apache.org/jira/browse/GROOVY-8274
             Project: Groovy
          Issue Type: Bug
          Components: groovy-runtime
    Affects Versions: 2.4.12
            Reporter: James Kleeh


{code}
class Foo {
    
    void executeClosure(Closure c) {
        c.resolveStrategy = Closure.DELEGATE_ONLY
        c.delegate = new Bar()
        c.call()
    }

    class Bar {
        def methodMissing(String name, args) {
            println name
        }
    }
}

Closure c = {
    go()
}

new Foo().executeClosure(c)
{code}

Executing the above results in:
{{groovy.lang.MissingMethodException: No signature of method: Foo.go() is applicable for argument types: () values: []}}

If the Bar class is moved out of Foo, it works as I expect.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)