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:29:58 UTC

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

    [ https://issues.apache.org/jira/browse/GROOVY-8014?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15710952#comment-15710952 ] 

Paul King commented on GROOVY-8014:
-----------------------------------

This issue depends on GROOVY-8011 if the order in which the 'super' property is displayed also needs to be controlled.

> @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 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.



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