Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.7
-
None
Description
Using the @groovy.transform.builder.Builder with SimpleStrategy yields the following problems.
Groovy input
@groovy.transform.builder.Builder class GroovyBuilderClassTarget { @groovy.transform.builder.Builder(builderStrategy= SimpleStrategy) class Person { String first String last Integer born } static void main(String[] args) { new GroovyBuilderClassTarget() } }
Groovy output:
@Builder public class GroovyBuilderClassTarget implements GroovyObject { @Generated public GroovyBuilderClassTarget() { CallSite[] var1 = $getCallSiteArray(); super(); MetaClass var2 = this.$getStaticMetaClass(); this.metaClass = var2; } public static void main(String... args) { CallSite[] var1 = $getCallSiteArray(); var1[0].callConstructor(GroovyBuilderClassTarget.class); } @Generated public static GroovyBuilderClassTarget.GroovyBuilderClassTargetBuilder builder() { CallSite[] var0 = $getCallSiteArray(); return (GroovyBuilderClassTarget.GroovyBuilderClassTargetBuilder)ScriptBytecodeAdapter.castToType(var0[1].callConstructor(GroovyBuilderClassTarget.GroovyBuilderClassTargetBuilder.class), GroovyBuilderClassTarget.GroovyBuilderClassTargetBuilder.class); } @Builder( builderStrategy = SimpleStrategy.class ) public class Person implements GroovyObject { private String first; private String last; private Integer born; @Generated public Person() { CallSite[] var2 = $getCallSiteArray(); super(); MetaClass var4 = this.$getStaticMetaClass(); this.metaClass = var4; } @Generated public GroovyBuilderClassTarget.Person setFirst(String first) { CallSite[] var2 = $getCallSiteArray(); this.first = first; return this; } @Generated public GroovyBuilderClassTarget.Person setLast(String last) { CallSite[] var2 = $getCallSiteArray(); this.last = last; return this; } @Generated public GroovyBuilderClassTarget.Person setBorn(Integer born) { CallSite[] var2 = $getCallSiteArray(); this.born = born; return this; } @Generated public String getFirst() { return this.first; } @Generated public String getLast() { return this.last; } @Generated public Integer getBorn() { return this.born; } } @Generated public static class GroovyBuilderClassTargetBuilder implements GroovyObject { @Generated public GroovyBuilderClassTargetBuilder() { CallSite[] var1 = $getCallSiteArray(); super(); MetaClass var2 = this.$getStaticMetaClass(); this.metaClass = var2; } @Generated public GroovyBuilderClassTarget build() { CallSite[] var1 = $getCallSiteArray(); GroovyBuilderClassTarget _theGroovyBuilderClassTarget = (GroovyBuilderClassTarget)ScriptBytecodeAdapter.castToType(var1[0].callConstructor(GroovyBuilderClassTarget.class), GroovyBuilderClassTarget.class); return _theGroovyBuilderClassTarget; } } }
I'd expect the following methods to have an @Generated annotation:
public static GroovyBuilderClassTarget.GroovyBuilderClassTargetBuilder builder()
public GroovyBuilderClassTarget.Person setFirst(String first)
public GroovyBuilderClassTarget.Person setLast(String last)
public GroovyBuilderClassTarget.Person setBorn(Integer born)
public GroovyBuilderClassTarget build()
Found during Hackergarten Zurich.
Attachments
Issue Links
- links to