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 2019/10/15 19:22:00 UTC

[jira] [Resolved] (GROOVY-1327) Closures in a derived class can't access package private fields of the base class in the same package.

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

Eric Milles resolved GROOVY-1327.
---------------------------------
    Resolution: Fixed

GROOVY-9063 and related recent changes for package-private member access has resolved this issue.

> Closures in a derived class can't access package private fields of the base class in the same package.
> ------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-1327
>                 URL: https://issues.apache.org/jira/browse/GROOVY-1327
>             Project: Groovy
>          Issue Type: Sub-task
>          Components: groovy-runtime
>    Affects Versions: 1.0-JSR-6
>         Environment: A recent build of 1.0-RC1
>            Reporter: Edward Povazan
>            Priority: Major
>         Attachments: groovytest.zip
>
>
> Java:
> public class A { String greeting = "Hello" }
> Groovy
> class B extends A { doGreet = { println greeting } }
> new B().doGreet().call()
> Both A and B are in the same package.
> Code in the closure will throw a MissingPropertyException, as greeting is not accessible but it should be.
> Changing this to either protected or public is a workaround.
> Attached test cases perform various visibilty tests.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)