[ https://issues.apache.org/jira/browse/GROOVY-7640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14967289#comment-14967289 ]
ASF GitHub Bot commented on GROOVY-7640: ---------------------------------------- GitHub user Controlix opened a pull request: https://github.com/apache/incubator-groovy/pull/152 GROOVY-7640 fixes Here is a test that demonstrates the bug and the fixes for Default-, Initializer-, and ExternalStrategy. I'm still working on the fix for the SimpleStrategy and I might enhance the tests for all strategies. You can merge this pull request into a Git repository by running: $ git pull https://github.com/Controlix/incubator-groovy master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-groovy/pull/152.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #152 ---- commit 91c4d5a033f600f8b584811affeaf012df7bcc60 Author: Marc Bogaerts <marcbogae...@telenet.be> Date: 2015-07-12T20:28:58Z GROOVY-7501: omit package name from builder class name commit 82d7ff0a448a53061d2a2c127478b47aa6ff8db2 Author: Marc Bogaerts <marcbogae...@telenet.be> Date: 2015-09-16T16:31:28Z Merge branch 'master' of github.com:apache/incubator-groovy commit 813a87c1932611b421deeda3231edb24fd91b49c Author: Marc Bogaerts <marcbogae...@telenet.be> Date: 2015-10-12T18:09:21Z Merge branch 'master' of github.com:apache/incubator-groovy commit f2cf935638b7821eda247450260e7d90566a9d59 Author: Marc Bogaerts <marcbogae...@telenet.be> Date: 2015-10-15T15:24:51Z Merge branch 'master' of github.com:apache/incubator-groovy commit 0c6c9bf5ba00bfb9784bcf77d186158e83f4ca28 Author: Marc Bogaerts <marcbogae...@telenet.be> Date: 2015-10-20T15:14:43Z GROOVY-7640: test demonstrating the bug commit 66ec7bc78ffe6f1eb55d45e1cbedbc1d9415335c Author: Marc Bogaerts <marcbogae...@telenet.be> Date: 2015-10-20T18:43:16Z GROOVY-7640: fix DefaultStrategy commit 7fb1f0e77f33a71e731904ab3de4e6d2945839e0 Author: Marc Bogaerts <marcbogae...@telenet.be> Date: 2015-10-20T19:02:03Z GROOVY-7640: fix InitializerStrategy commit 461e372cc119891bc0e5eb649f6a863ac2142b5b Author: Marc Bogaerts <marcbogae...@telenet.be> Date: 2015-10-20T19:11:37Z GROOVY-7640: fix ExternalStrategy commit dafa8bbc5b748018d5ee35994caaea82d66c695f Author: Marc Bogaerts <marcbogae...@telenet.be> Date: 2015-10-20T19:22:25Z Merge remote-tracking branch 'upstream/master' ---- > AST Builder should include superclass properties > ------------------------------------------------ > > Key: GROOVY-7640 > URL: https://issues.apache.org/jira/browse/GROOVY-7640 > Project: Groovy > Issue Type: Bug > Components: ast builder > Affects Versions: 2.4.5 > Reporter: Marc Bogaerts > Priority: Minor > > If one annotates a groovy class with @Builder and that class extends from > another class, then the generated builder does not support setting the parent > class properties. > This is especially problematic when mixin groovy builders in java code. > e.g. the following class shows what will and will not compile > {code:java} > // Animal.groovy > import groovy.transform.builder.Builder > import groovy.transform.builder.SimpleStrategy > @Builder(builderStrategy = SimpleStrategy) > class Animal { > String color > int legs > } > // Pet.groovy > import groovy.transform.builder.Builder > import groovy.transform.builder.SimpleStrategy > @Builder(builderStrategy = SimpleStrategy) > class Pet extends Animal { > String name > } > // PetTest.java > import org.junit.Test; > import static org.junit.Assert.*; > public class PetTest { > @Test public void createPet() { > // Pet pet = new Pet().setColor("white").setLegs(4).setName("Bobby"); > does not compile > Pet pet = (Pet) new > Pet().setName("Bobby").setColor("white").setLegs(4); > assertTrue(pet.getLegs() == 4); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)