Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.8, 3.0.0-rc-1
-
None
Description
Compilation fails when accessing a protected(via `thisObject`, `owner` and `delegate`)/package-private super class field from inside a closure:
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"'
Attachments
Issue Links
- is cloned by
-
GROOVY-9293 Compilation error when accessing package-private super class field using `this` from inside a closure
- Closed
- relates to
-
GROOVY-9288 Compilation error when accessing a protected super class field from inside a closure
- Closed
- links to