Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.6
-
None
Description
import groovy.transform.TupleConstructor import groovy.transform.ToString import groovy.transform.InheritConstructors import groovy.transform.builder.Builder import groovy.transform.builder.SimpleStrategy @Builder(builderStrategy=SimpleStrategy, prefix='with') @TupleConstructor @ToString class Person{ String name; void setName(String n){ println "Called setName(n=$n)" name = n; } } println Person.constructors println ( [ new Person(name: 'Map style'), new Person('@TupleConsructor'), new Person().with{ name = 'With style'; it }, new Person().withName('@Builder') ] )
In output we get:
Called setName(n=Map style) Called setName(n=With style) [Person(Map style), Person(@TupleConsructor), Person(With style), Person(@Builder)]
So, all forms of new object instatiation like Map-style, With block became different with new methods, defined by AST transformations.