RFR: 8275075: Remove unnecessary conversion to String in jdk.hotspot.agent

Chris Plummer cjplummer at openjdk.java.net
Tue Oct 12 05:50:46 UTC 2021


On Sun, 3 Oct 2021 18:58:50 GMT, Andrey Turbanov <duke at openjdk.java.net> wrote:

> Cleanup unnecessary toString() calls when conversion will happen implicitly anyway

Marked as reviewed by cjplummer (Reviewer).

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java line 1012:

> 1010:          tmpBuf.append(Long.toHexString(startPc + visitor.getInstructionSize()));
> 1011:          tmpBuf.append(",0x");
> 1012:          tmpBuf.append(Long.toHexString(startPc));

Overall these changes look good, although I do wonder what motivated to `toString()` calls in the first place, especially this example where lines 1010 and 1012 are similar, but only 1010 used `toString()`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5800


More information about the serviceability-dev mailing list