Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10705

ToString order bug for super properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.5, 3.0.13
    • None
    • None

    Description

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

      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)
      

      However, the expected order is for properties within the child class to follow declaration order.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              paulk Paul King
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: