You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/03/24 14:29:00 UTC

[jira] [Resolved] (GROOVY-8104) Could not call constructor of inner class from anonimous class inside closure

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

Eric Milles resolved GROOVY-8104.
---------------------------------
    Fix Version/s: 4.0.0-alpha-3
       Resolution: Fixed

> Could not call constructor of inner class from anonimous class inside closure
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-8104
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8104
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: ks.zealot
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 4.0.0-alpha-3
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> When I was trying to call constructor from anonymous class, I  catch strange exception
> {code}
> Could not find matching constructor for: A$B(A$_foo_closure1)
> {code}
> Here is a reproduction
> {code}
> interface I {
>     void bar(Object o)
> }
> class A {
>     void foo(){
>         C c = new C()
>         ['1','2','3'].each {
>             obj ->
>                 c.baz(obj, new I() {
>                     @Override
>                     void bar(Object o) {
>                         B b = new B(  )
>                     }
>                 })
>         }
>     }
>     class B {
>     }
> }
> class C {
>     void baz(Object o, I i) {
>         i.bar(o)
>     }
> }
> A a = new A()
> a.foo()
> {code}
> When my inner class have fields, exception is slightly different
> {code}
> GroovyRuntimeException: Could not find matching constructor for: A$B(A$_foo_closure1, java.util.LinkedHashMap)
> {code}
> Enviroment : groovy 2.3.9



--
This message was sent by Atlassian Jira
(v8.3.4#803005)