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 2023/07/18 21:33:00 UTC
[jira] [Commented] (GROOVY-11128) implicit-this access within closure to private members in declaring class when invoked from derived class
[ https://issues.apache.org/jira/browse/GROOVY-11128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744360#comment-17744360 ]
Eric Milles commented on GROOVY-11128:
--------------------------------------
https://github.com/apache/groovy/commit/a4eef0748bd85b0990e8ffc5df3f95c299a32fd2
> implicit-this access within closure to private members in declaring class when invoked from derived class
> ---------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-11128
> URL: https://issues.apache.org/jira/browse/GROOVY-11128
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Fix For: 5.0.0-alpha-1
>
>
> Separate ticket for implicit-this style access to private fields, methods, and properties from closure within declaring class.
> Consider the following:
> {code:groovy}
> class C {
> protected String protectedMethod() {
> def closure = { ->
> privateMethod()
> }
> closure()
> }
> private String privateMethod() {
> 'hello world'
> }
> }
> class D extends C {
> void test() {
> def result = protectedMethod()
> assert result == 'hello world'
> }
> }
> new D().test()
> {code}
> See also GROOVY-2433, GROOVY-2565, GROOVY-3073, GROOVY-3142, GROOVY-4083, GROOVY-4084, GROOVY-4692, GROOVY-5438, GROOVY-6335, GROOVY-8905, GROOVY-9987, GROOVY-10723, et al.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)