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 2026/03/14 19:01:00 UTC

[jira] [Resolved] (GROOVY-7685) Category overrides closure delegate

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

Eric Milles resolved GROOVY-7685.
---------------------------------
    Fix Version/s: 6.0.0-alpha-1
       Resolution: Fixed

https://github.com/apache/groovy/commit/86cf6f1dbd9d0cdf0c73c8903f3830b2e3188b30

> Category overrides closure delegate
> -----------------------------------
>
>                 Key: GROOVY-7685
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7685
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Daniil Ovchinnikov
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 6.0.0-alpha-1
>
>
> {code:title=nested_closures.groovy}
> class X {
>     def method() {
>         "method $X.name"
>     }
> }
> class MethodCategory {
>     static method(a) {
>         "method $MethodCategory.name"
>     }
> }
> use(MethodCategory) {
>     def c = {
>         println "owner ${owner.class.name}"         // owner nested_closures$_run_closure1
>         println "delegate ${delegate.class.name}"   // delegate X
>         println method()                            // !! method MethodCategory
>     }
>     c.resolveStrategy = Closure.DELEGATE_ONLY
>     c.delegate = new X()
>     c()
> }
> {code}
> The {{method()}} call inside the {{c}} closure should return {{method X}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)