get_type_hierarchy
Get the full type hierarchy for a Java type: superclasses, interfaces, and subtypes. Find types by cursor position or qualified name.
Instructions
Get the type hierarchy (supertypes and subtypes) for a Java type.
USAGE: Position on a type, returns full inheritance chain OUTPUT: Superclasses, interfaces, and all subtypes
Can be called with either:
File position (filePath, line, column) - finds type at cursor
Type name (typeName) - looks up type by qualified name
IMPORTANT: Uses ZERO-BASED coordinates when using file position.
unresolvedSupertypes, present only when there are any, names each supertype the compiler cannot resolve (a missing dependency), as the declaration writes it, with the type whose declaration names it: this type or one of its supertypes. The superclasses then run to the last that resolves and end with java.lang.Object. potentialMatches are the places naming the type, or a subtype, as a supertype that JDT could not confirm.
maxResults, the most entries each of superclasses, interfaces and subtypes lists (totalSuperclasses, totalInterfaces and totalSubtypes count all of them, and meta.truncated says when a list is cut), is 1 to 50; outside that range is INVALID_PARAMETER.
potentialMatches, present only when there are any, holds the places JDT's search reports as possible matches but cannot confirm, because a type or name there does not resolve (a missing dependency or a compile error): count is their exact number, and locations lists them, as many as the results it stands beside may list. They are never counted or listed as results.
Requires load_project to be called first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | No | Zero-based line number | |
| column | No | Zero-based column number | |
| filePath | No | Path to source file (for position-based lookup) | |
| typeName | No | Fully qualified type name (alternative to position) | |
| maxResults | No | Most entries each list holds, 1 to 50 (default 10) |