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 2019/12/09 21:37:02 UTC

[jira] [Closed] (GROOVY-9292) Compilation error when accessing a protected super class field from a closure using owner, delegate or thisObject qualifier (different package)

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

Paul King closed GROOVY-9292.
-----------------------------

> Compilation error when accessing a protected super class field from a closure using owner, delegate or thisObject qualifier (different package)
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-9292
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9292
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.5.8, 3.0.0-rc-1
>            Reporter: Daniel Sun
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 3.0.0-rc-2
>
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Compilation fails when accessing a protected(via `thisObject`, `owner` and `delegate`)/package-private super class field from inside a closure:
> {code:java}
> new GroovyShell().with {
>   evaluate '''
>     package a
>     
>     abstract class Abstract {
>         protected String protectedField = 'field'
>     }
>     assert true
>     '''
>   evaluate '''
>     package b
>     
>     @groovy.transform.CompileStatic
>     class Concrete extends a.Abstract {
>         String doThing() {
>             'something'.with {
>                 return owner.protectedField // `thisObject.protectedField`, `delegate.protectedField` fails too
>             }
>         }
>     }
>     assert true
>     '''
>   evaluate 'assert new b.Concrete().doThing() == "field"'
> {code}



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