Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Given a class:
class Foo { String a, b private String c, d }
Adding a toString annotation, e.g. @ToString(includeFields=true) will output the properties/fields in an unspecified order - basically the order the properties are returned followed by the order that the fields are returned. This can be different for different Java versions.
The proposal is that if includes='a,c,b,d' is added, then the fields/properties will be output in that order. This could be considered a breaking change for anyone using 'includes' and relying on the current ordering but as mentioned earlier, this is currently different for different Java versions and possibly different on different JVMs (e.g. Azul, IBM, Oracle, OpenJDK or possibly on different platforms). The proposal will at least give a mechanism to have a defined order.
Attachments
Issue Links
- depends upon
-
GROOVY-8011 @ToString if used with includes='prop1,prop2' could allow the pseudo prop name 'super' as an alternative to using the includeSuper flag
- Closed