CodeQL library for Java/Kotlin
codeql/java-all 0.9.2-dev (changelog, source)
Search

Member predicate MetricRefType::getInheritanceDepth

Gets the depth of the inheritance tree.

This metric measures the maximum distance from Object in the type hierarchy. It is sometimes considered that classes that are very deeply nested may be difficult to maintain.

Note that definitions of “depth of inheritance tree” vary among systems for computing metrics. This implementation uses the definition from Spinellis’s book and tool (ckjm). A different tool, NDepend, defines the inheritance depth to be the total number of supertypes, which is implemented using the getNumberofAncestors() method.

int getInheritanceDepth()