Eric Milles created GROOVY-8167:
-----------------------------------

             Summary: Direct field access fails for superclass fields
                 Key: GROOVY-8167
                 URL: https://issues.apache.org/jira/browse/GROOVY-8167
             Project: Groovy
          Issue Type: Bug
            Reporter: Eric Milles


About half the time I need to quickly fill in a private field for a test or a 
bit of prototype code, I end up having to bust out Apache Commons Lang's 
{{FieldUtils}}, because the Groovy direct field access operator {{.@}} does not 
allow access to fields in a super type.  The operator is very handy in 
preventing use of reflection code, but its potential is not fully realized.

Here is a example:
{code}
class A { private String one }
class B extends A { private String two }

B b = new B()
b.@two = '' // works as expected
b.@one = '' // fails with MissingFieldException: No such field: one for class: B
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to