JDK-8068830 : Runtime: Add Diagnostic Command that prints supertypes of a given type
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 10
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2015-01-12
  • Updated: 2018-01-03
  • Resolved: 2018-01-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 12
12Resolved
Related Reports
Relates :  
Description
8054888 is an rfe to print superclass hierarchy - either starting with java.lang.Object, or potentially
starting at a specified class or interface and looking to see what inherits from it.

This request is the inverse - which is to start at a given type (class or interface) and find
out what superclasses and superinterface it inherits from, including the hierarchy, so that
if a superinterface is inherited via a superclass rather than directly, that information would
be available.

I would suggest that the information printed would include both class name and defining loader
information.

Ok to wait for feedback on 8054888 or requests from others before implementing this. i.e. to mark jdk10.
Comments
based on the evaluation from Chris, this is no longer an issue as the support had already been added. Closing as NAI
03-01-2018

I think in the end I made JDK-8054888 also cover what is being requested here -------------------------------------------------------- Syntax : VM.class_hierarchy [options] [<classname>] Arguments: classname : [optional] Name of class whose hierarchy should be printed. If not specified, all class hierarchies are printed. (STRING, no default value) Options: (options must be specified using the <key> or <key>=<value> syntax) -i : [optional] Inherited interfaces should be printed. (BOOLEAN, false) -s : [optional] If a classname is specified, print its subclasses. Otherwise only its superclasses are printed. (BOOLEAN, false). -------------------------------------------------------- $> jcmd NeverExit VM.class_hierarchy java.lang.Error -i 7836: java.lang.Object/null |--java.lang.Throwable/null | implements java.io.Serializable/null (declared intf) | |--java.lang.Error/null | | implements java.io.Serializable/null (transitive intf) -------------------------------------------------------- If you leave off -s, you don't get all the noise of the subclasses, and the output appears to be what is requested by this RFE.
02-01-2018

Yes, but the idea is to show the full superclass/interface hierarchy of every class in the hierarchy. If you have a suggestion on how to improve this, I'd love to here it. I suppose we could just remove Object since every class inherits from it. This would cut down on the noise. But we need to leave in the other replicated classes, such as Collection and Iterable in the example above.
26-01-2015

I think the multiple occurrence of java/lang/Object is a bit confusing.
26-01-2015

The recommendation is for something similar to the trace output for default method processing, but with a bit more info for each class, including whether or not it is an interface. The hierarchy would look something like: java/util/Arrays$ArrayList java/util/AbstractList java/util/AbstractCollection java/lang/Object java/util/Collection java/lang/Object java/lang/Iterable java/lang/Object java/util/List java/lang/Object java/util/Collection java/lang/Object java/lang/Iterable java/lang/Object java/util/RandomAccess java/lang/Object java/io/Serializable java/lang/Object
26-01-2015