Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.5
-
None
Description
Given the following code, I would expect the assertions to pass. They currently don't. However, if the a and b properties are typed to String, for example, everything goes as expected.
It might be challenging to get this to work properly for more complex types, but it would make the annotations really transparent. The way it currently behaves is very unsettling (a is set with a Map containing both a and b with their respective values, while b is not set to anything)
import groovy.transform.Canonical def weird = new CanonicalIsWeird(a: 'first letter', b: 'second letter') println "a: ${weird.a}" println "b: ${weird.b}" assert weird.a == 'first letter' assert weird.b == 'second letter' @Canonical class CanonicalIsWeird { def a, b }
Attachments
Issue Links
- is part of
-
GROOVY-10796 TupleConstructor and map-ish constructor style don't mix
- Closed