Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8354362

Use automatic indentation in CollectedHeap printing

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • hotspot
    • None
    • gc

      Currently, the CollectedHeap printing code (print_on and print_on_error, and calls "below") prepends spaces in messages in a way that only makes sense if you write the code and then check the output to see if you've done everything correctly. To make writing printing code easy, I suggest we move to a system where each printing method, starting at callers of print_on and print_on_error, uses the indentation API in outputStream and does not rely on prepending spaces like is done right now.

      I suggest that any (GC) printing method should not make any assumptions of the indentation level of its caller(s). This means that each function shall:
      1. Not prepend any spaces to its printing, and instead expect that the caller(s) should handle any indentation before calling this function.
      2. Enforce its own indentation, by enabling auto indentation in its own context and for its "lower level" calls (if that's the desired outcome).

      Combining these two rules means that *any* (GC) printing method can be called from anywhere and give sensible output, without (seemingly) random indentation of expectations elsewhere.

            jsikstro Joel Sikstrom
            jsikstro Joel Sikstrom
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: