You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/11/11 02:01:05 UTC

[jira] [Closed] (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 ]

Paul King closed GROOVY-1327.
-----------------------------

> 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)