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

Paul King commented on GROOVY-10705:
------------------------------------

Pseudo-properties (AKA JavaBean properties) are also affected:
{code}
class Base {
    String getA() { 'base a' }
    String getC() { 'base c' }
}

@groovy.transform.ToString(includeSuperProperties=true, allProperties=true)
class Child extends Base {
    String getA() { 'child a' }
    String getB() { 'child b' }
}

println new Child() // Child(child b, base c, child a)
{code}

> ToString order bug for super properties
> ---------------------------------------
>
>                 Key: GROOVY-10705
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10705
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> In the doco for @ToString, we indicate that properties from a child come 
> before properties from super classes. This is true but properties that also 
> happen to be present in super classes don't keep their respective order with 
> other properties, e.g.:
> {code:java}
> class Base {
>     String a = 'base a'
>     String c = 'base c'
> }
> @groovy.transform.ToString(includeSuperProperties=true)
> class Child extends Base {
>     String a = 'child a'
>     String b = 'child b'
> }
> println new Child() // => Child(child b, child a, base c)
> {code}
> However, the expected order is for properties within the child class to 
> follow declaration order.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to