Jason Terhune-Wold created GROOVY-8186:
------------------------------------------

             Summary: Builder ExternalStrategy constructors have trouble with 
private fields
                 Key: GROOVY-8186
                 URL: https://issues.apache.org/jira/browse/GROOVY-8186
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.4.x, 2.5.x
            Reporter: Jason Terhune-Wold
            Priority: Minor


An undocumented feature of @Builder is that the builder's constructor can set 
default values for the fields. See 
http://stackoverflow.com/questions/35066664/default-values-in-groovy-builder-ast

I tried creating an ExternalStrategy @Builder annotation for 
[BaseClientDetails|http://docs.spring.io/spring-security/oauth/apidocs/org/springframework/security/oauth2/provider/client/BaseClientDetails.html]
 with a constructor that set a default scope. I received a 
MissingMethodException exception, which I thought was odd.

I added some tests to BuilderTransformTest that demonstrate apparent problems 
using the external builder in two situations:
1) A groovy class with private fields and manually defined setters.
2) A java class with a private Set field and a setter that takes a Collection

The tests are here: 
https://github.com/jterhune/groovy/commit/5b2eb74cc8184235b5235b7fd4c80b241799bbc5

I noticed this in 2.4.x. My tests fail in the 2.5.x branch also.




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

Reply via email to