groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Kleeh (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-8274) methodMissing not executed when the delegate is an inner class
Date Mon, 31 Jul 2017 22:33:00 GMT
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)

Mime
View raw message