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

Include inherited properties with @ToString

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3.7
    • 2.4.0-rc-1
    • None
    • None

    Description

      The @ToString annotation only includes properties that are directly declared on the current class, and not any properties that are inherited. I have a small hierarchy of Spring Data @Documents that inherit from a common abstract base (with ID, status key, and the like), and it is most natural for the @ToString to include all properties, not just the ones declared on the concrete classes. includeSuper is a usable workaround but awkward because the base class is never instantiated and splitting the properties up is a bit confusing.

      It would be helpful to be able to tell @ToString to include inherited properties when generating the toString().

      Attachments

        Activity

          People

            paulk Paul King
            chrylis Christopher Smith
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: