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 2024/09/10 16:37:00 UTC
[jira] [Resolved] (GROOVY-9418) Why implicitly call of the inner class instance not allowed?
[ https://issues.apache.org/jira/browse/GROOVY-9418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-9418.
---------------------------------
Resolution: Fixed
This works for the latest Groovy 3, 4 and 5 releases. Not sure the exact revision numbers without some additional testing.
> Why implicitly call of the inner class instance not allowed?
> ------------------------------------------------------------
>
> Key: GROOVY-9418
> URL: https://issues.apache.org/jira/browse/GROOVY-9418
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 2.4.18
> Reporter: gekm
> Priority: Major
>
> A parent and inner child classes:
> {code}
> class Parent {
> def name
> def child = new Child()
> def call() {
> println('parent called')
> }
> }
> class Child {
> def call() {
> println('child called')
> }
> }
> {code}
> Calling:
> {code}
> import base.Parent
> parent = new Parent(name: 'parent')
> parent()
> parent.child.call()
> parent.child()
> {code}
> output:
> {noformat}
> parent called
> child called
> Caught: groovy.lang.MissingMethodException: No signature of method: base.Parent.child() is applicable for argument types: () values: []
> Possible solutions: call(), find(), find(groovy.lang.Closure), getChild(), setChild(java.lang.Object), split(groovy.lang.Closure)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)