Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.21, 4.0.21
-
None
Description
Consider the following:
package p; abstract class A { private Object getX() { return "X"; } /*package*/ Object getY() { return "Y"; } }
@groovy.transform.CompileStatic class C extends p.A implements Map<String,String> { @Delegate Map<String,String> map = [:] void test() { print this.x // Cannot access method: getX() of class: p.A print this.y // IllegalAccessError: class C tried to access method p.A.getY() } }
STC is happy with both property expressions since they can be satisfied via the Map interface. Classgen emits error for the private getter and writes out a call to the package-private getter. In GROOVY-11367, these are noted in #5: "this.any // getter (public, protected, package-private if same-package) or entry (private, package-private if other-package)"