[ 
https://issues.apache.org/jira/browse/GROOVY-9287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16957862#comment-16957862
 ] 

Paul King commented on GROOVY-9287:
-----------------------------------

Glad you got it working. I created and fixed GROOVY-9289 to handle showing an 
error for ignored in/excludes for @Delegate.

> @Delegate( exclude ) option is ignored
> --------------------------------------
>
>                 Key: GROOVY-9287
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9287
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.5.4
>         Environment: gradle plugin project, built with gradle 5.6.2,  test 
> source using spock-1.3 with
> groovy-2.5.4
>            Reporter: Dariusz Hudziak
>            Priority: Major
>
> It seems to me that @Delegate annotation is broken with regard to it's 
> exclude property:
> Consider the following spock test:
> {code}
> class WMap {
>   String name;
>   @Delegate( excludes = "name,a" )
>   Map<String,String> data;
>  
>   WMap(String name, Map<String, String> data) {
>     this.name = name
>     this.data = data
>   }
> }
> def 'Test WMap properties'() {
>   given:
>     def map = new WMap('example',['a':'valA',b:'valB','name':'wierd'])
>   expect:
>     map.name == 'example' // fail it's "wierd"   map.a == 'valA' // but what 
> about exclude = a ?
> }
> {code}
>  In the above example we see a class that is composed with map object. 
> Despite having 
> regurral name property,  lookups for this property end up in the target map. 
> It is stated in documentation that only functions existing on delegate target 
> java type are delegated ( not any GroovyObject functions ) but it seems that 
> the dynamic property for each key functionallity works on the WMap  where it 
> should not.
> The fact that it works is no big deal,  but only if the exclude works - but 
> as we can see the
> exclude is ignored  and more over properties are covered which should be 
> avoided



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to