You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2016/12/01 05:25:58 UTC

[jira] [Created] (GROOVY-8014) @ToString could output properties in a predefined order when 'includes' is used

Paul King created GROOVY-8014:
---------------------------------

             Summary: @ToString could output properties in a predefined order when 'includes' is used
                 Key: GROOVY-8014
                 URL: https://issues.apache.org/jira/browse/GROOVY-8014
             Project: Groovy
          Issue Type: Improvement
          Components: xforms
            Reporter: Paul King
            Assignee: Paul King


Given a class:
{code}
class Foo {
  String a, b
  private String c, d
}
{code}
Adding a toString annotation, e.g. {{@ToString(includeFields=true)}} will output the 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)