eric-milles commented on pull request #1674:
URL: https://github.com/apache/groovy/pull/1674#issuecomment-1010106711


   It was intended to make this read the property and not from the map:
   ```groovy
   class C {
       @Delegate Map m = [:]
       def x = 4
       public y = 5
       void method() {
           def v = 3
           assert 3 == { -> v }()
           assert 4 == { -> x }() // previously preferred map lookup
           assert 5 == { -> y }() // previously preferred map lookup
       }
   }
   ```
   
   I thought the first step would be to have read of `public` field or accessor 
gain precedence over map lookup.  For write it already includes `public` and 
`protected`.  I took the cautions approach by dealing with `public` first and 
leaving `protected` as-is.
   
   The idea here is that if you created a type that implements `Map` but then 
added public API, that API should take precedence over the general map property 
mechanism.
   
   For legacy support, any code may replace `name` with `get('name')` to stick 
with the map.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to