[
https://issues.apache.org/jira/browse/GROOVY-7685?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-7685:
--------------------------------
Language: groovy
> 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
>
> {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)