Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
This is probably just a slice of GROOVY-1591, GROOVY-3010, GROOVY-3142, GROOVY-5438, et al.
Adding "super." qualifier causes strange behaviors. Consider the following:
class Foo { private String field = 'field' private String method() { 'method' } } class Bar extends Foo { def baz() { field // MissingPropertyException: No such property: field for class: Bar method() // MissingMethodException: No signature of method: Bar.method() this.field // MissingPropertyException: No such property: field for class: Bar this.method() // MissingMethodException: No signature of method: Bar.method() super.@field // MissingFieldException: No such field: field for class: Bar -- fixed by GROOVY-8999 // so far, so good -- although Groovy allows access to private fields and methods from outside of Bar and Foo super.field // MissingMethodException: No signature of method: Bar.getField() -- that's strange super.method() // returns "method" -- Why is this okay? (super.&method)() // MissingMethodException: No signature of method: Bar.method() is applicable for argument types: () values: [] } }
Attachments
Issue Links
- is a clone of
-
GROOVY-8999 Access to private fields and methods from subclass exhibits strange behavior
- Closed
- relates to
-
GROOVY-11319 Access to a private property of a parent object is not caught
- Closed