[
https://issues.apache.org/jira/browse/GROOVY-9418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
gekm updated GROOVY-9418:
-------------------------
Description:
A parent and inner child classes:
{quote}class Parent {
def name
def child = new Child()
def call()
println('parent called')
class Child
Unknown macro: \{ def call() println('child called') }
}
{quote}
Calling:
{quote}import base.Parent
parent = new Parent(name: 'parent')
parent()
parent.child.call()
parent.child()
{quote}
output:
{quote}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)
{quote}
was:
It looks like your post is mostly code; please add some more details.
Details: I use groovy 2.4.18
A parent and inner child classes:
{quote}class Parent {
def name
def child = new Child()
def call()
println('parent called')
class Child {
def call()
println('child called')
}
}
{quote}
Calling:
{quote}import base.Parent
parent = new Parent(name: 'parent')
parent()
parent.child.call()
parent.child()
{quote}
output:
{quote}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)
{quote}
> 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 Console, groovy-runtime
> Affects Versions: 2.4.18
> Reporter: gekm
> Priority: Major
>
> A parent and inner child classes:
> {quote}class Parent {
> def name
> def child = new Child()
> def call()
> println('parent called')
> class Child
> Unknown macro: \{ def call() println('child called') }
> }
> {quote}
> Calling:
> {quote}import base.Parent
> parent = new Parent(name: 'parent')
> parent()
> parent.child.call()
> parent.child()
> {quote}
> output:
> {quote}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)
> {quote}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)