If unloading, ClassLoaderData::loader_name() will show loader name if set, otherwise loader class name.
If not unloading, ClassLoaderData::loader_name() will just show the loader class name.
This should be consistent.
Also, I would prefer if we had separate accessors to each thing, so:
ClassloaderData::loader_name()
- return cached loader name if unloading, otherwise loader_oop->name
ClassloaderData::loader_class_name()
- return cached loader class name if unloading, otherwise loader_oop->klass->name
And then, if even necessary, a compound version of this:
ClassloaderData::loader_name_and_class_name()
which outputs something like "<name> (instance of <classname>)".
to replace the current existing users of the current loader_name().
The change looks easy but to ensure that no existing caller of ClasslaoderData::loader_name() trips over the changed output may vbe the real problem.