On Tue, 20 Sep 2022 05:37:44 GMT, Thomas Stuefe <[email protected]> wrote:
>> Fixes a bug in the `VM.classloaders` jcmd that causes class loaders to be
>> omitted from the output if a parent class loader never loaded any class and
>> therefore had no associated DCmd.
>>
>> The fix changes the command to not rely on the existence of a CLD structure
>> for the loader; instead, all information (loader class name, loader name,
>> etc) is pulled via the loader oop, which has to be always there unless its
>> the bootstrap loader.
>>
>> Also, the tests were expanded to test the display of empty loaders and empty
>> parent loaders.
>>
>> Thanks to @dholmes-ora for finding this bug.
>
> Thomas Stuefe has updated the pull request incrementally with one additional
> commit since the last revision:
>
> cjplummer feedback
Hi Thomas,
Generally this seems fine - but one issue below.
Thanks.
src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp line 209:
> 207: st->print(" \"%s\",", the_loader_name);
> 208: }
> 209: st->print(" %s", the_loader_class_name);
`the_loader_class_name` could be NULL here. You need to change
`loader_class_name()` t return "??" like the original code uses.
-------------
Changes requested by dholmes (Reviewer).
PR: https://git.openjdk.org/jdk/pull/10312