You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/07/23 14:17:05 UTC

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

     [ https://issues.apache.org/jira/browse/GROOVY-8274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-8274.
-----------------------------

> 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
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-1, 3.0.5
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {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
(v8.3.4#803005)