RFR: 8287008: Improve tests for thread dumps in JSON format [v3]

Chris Plummer cjplummer at openjdk.java.net
Mon May 23 17:03:04 UTC 2022


On Mon, 23 May 2022 07:52:58 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> test/jdk/com/sun/management/HotSpotDiagnosticMXBean/DumpThreads.java line 115:
>> 
>>> 113: 
>>> 114:                 // find the thread container that corresponds to the executor
>>> 115:                 String name = Objects.toIdentityString(executor);
>> 
>> I don't understand the need for `toIdentityString()` rather than just `toString()`
>
> The implementation lends on the string returned by Object::toString when not overridden. In this case, either will do so I can change it to toString.

Yeah, the fact that it's known not to be overridden makes it confusing that toIdentityString() is used. But if you feel this helps better document what the dumping implementation uses, it might be better to use toIdentityString(). It makes for accurate example code in that case. Either is ok (or maybe just a useful comment)

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

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


More information about the serviceability-dev mailing list