-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 3.0.0-rc-2
-
Component/s: None
-
Labels:None
Follow up to GROOVY-8999, GROOVY-9093 and GROOVY-9136. Consider the following:
class Foo { private String field = 'value' } class Bar { @groovy.transform.CompileStatic void test(Foo foo) { foo.with { field // Access to Foo#field is forbidden } } }
class Foo { private String field = 'value' } class Bar { @groovy.transform.CompileStatic void test(Foo foo) { println foo.field } } new Bar().test(new Foo()) // prints "value"
Since STC produces an error for access to Foo.field as variable expression, I would expect the same error for access to the field through property expression. Same goes for protected and package-private with the appropriate package separation of Foo and Bar.
- links to