On Tue, 21 Dec 2021 23:01:20 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
>> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java >> line 560: >> >>> 558: } else { >>> 559: out.println(); >>> 560: } >> >> I wonder if it is possible to simplify the above fragment at 549-560 with >> something like: >> if (verbose) { >> // If we know what this is a pointer to, then print >> additional information. >> PointerLocation loc = PointerFinder.find(val); >> if (!loc.isUnknown()) { >> out.print(" "); >> loc.printOn(out, false, false); // make it >> print without line end or ignore there is an extra end? >> } >> } >> out.println(); > > `printOn()` always prints a newline. It's hard to make it not do that since > it relies on other `print` APIs, some of which print newlines and some of > which don't (in which case `printOn()` will print a newline). So I can't > easily just create a `printOn()` variant that doesn't print newlines, and > printing two newlines would introduce a bunch of blank lines in the output, > which wouldn't look good. Okay, thanks. ------------- PR: https://git.openjdk.java.net/jdk/pull/6902