You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Tomasz Przybysz (Jira)" <ji...@apache.org> on 2021/04/30 14:16:00 UTC
[jira] [Updated] (GROOVY-10066) Nested @Delegate throws
MissingMethodException
[ https://issues.apache.org/jira/browse/GROOVY-10066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tomasz Przybysz updated GROOVY-10066:
-------------------------------------
Description:
Consider the following snippet:
{code:java}
class Top {
@Delegate
private final Middle middle = new Middle()
void top() {
println 'top'
}
}
class Middle {
@Delegate
private final Bottom bottom = new Bottom()
void mid() {
println 'mid'
}
}
class Bottom {
void bot() {
println 'bot'
}
}
def foo = new Top()
foo.top()
foo.mid()
foo.bot()
{code}
The last line throws
{{groovy.lang.MissingMethodException: No signature of method: Top.bot()}}
I am not sure if the issue is a bug or perhaps should be a new feature/improvement, shouldn't it work though?
was:
Consider the following snippet:
{code:java}
class Top {
@Delegate(includeTypes = [Middle, Bottom])
private final Middle middle = new Middle()
void top() {
println 'top'
}
}
class Middle {
@Delegate
private final Bottom bottom = new Bottom()
void mid() {
println 'mid'
}
}
class Bottom {
void bot() {
println 'bot'
}
}
def foo = new Top()
foo.top()
foo.mid()
foo.bot()
{code}
The last line throws
{{groovy.lang.MissingMethodException: No signature of method: Top.bot()}}
I am not sure if the issue is a bug or perhaps should be a new feature/improvement, shouldn't it work though?
> Nested @Delegate throws MissingMethodException
> ----------------------------------------------
>
> Key: GROOVY-10066
> URL: https://issues.apache.org/jira/browse/GROOVY-10066
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 3.0.8
> Reporter: Tomasz Przybysz
> Priority: Major
>
> Consider the following snippet:
>
> {code:java}
> class Top {
> @Delegate
> private final Middle middle = new Middle()
> void top() {
> println 'top'
> }
> }
> class Middle {
> @Delegate
> private final Bottom bottom = new Bottom()
> void mid() {
> println 'mid'
> }
> }
> class Bottom {
> void bot() {
> println 'bot'
> }
> }
> def foo = new Top()
> foo.top()
> foo.mid()
> foo.bot()
> {code}
>
> The last line throws
> {{groovy.lang.MissingMethodException: No signature of method: Top.bot()}}
> I am not sure if the issue is a bug or perhaps should be a new feature/improvement, shouldn't it work though?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)