Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.8
-
None
-
None
Description
@MapConstructor Breaks in Groovy4 when combined with @TupleConstructor, fine in Groovy3
Example in Groovy4
import groovy.transform.* @MapConstructor(includeFields = true) @TupleConstructor(includeFields = true) @ToString(includeNames = true, includeFields = true) class Foo { private final float w = 1 private final int x private int y = 1 private final int z } println new Foo(x:2, z: 3)
outputs the incorrect value
Foo(x:2, y:0, z:3)
In Groovy3 it outputs the correct
Foo(x:2, y:1, z:3)
Also commenting out @TupleConstructor in Groovy4 causes the output to be the correct value.
Attachments
Issue Links
- is related to
-
GROOVY-10238 @CompileStatic @Canonical inner class throws RTE: NoSuchMethodError: java.util.Map.withDefault
- Closed
- relates to
-
GROOVY-10925 @TupleConstructor namedVariant breaks on setting private final fields in constructor
- Open