Class ClassTree

java.lang.Object
org.codehaus.groovy.tools.groovydoc.ClassTree

public final class ClassTree extends Object
GROOVY-11942: builds the inheritance/extension trees rendered by the overview-tree.html and package-tree.html templates.

Produces two separate trees:

  • The class tree is rooted at java.lang.Object and built by walking each class's getParentClasses() chain, so external ancestors (like java.lang.Throwable) appear as non-link nodes joining the documented classes to Object.
  • The interface tree lists top-level interfaces and traits whose parent interfaces are not themselves documented in this tree, with children determined by direct extends relationships between documented interfaces. Interfaces with multiple parents may appear under more than one root.

Traits are treated as interfaces for the purposes of grouping, matching their JVM representation, but retain their isTrait() flag so templates can render them with a distinct label.

  • Method Details

    • buildClassTree

      public static ClassTree.Node buildClassTree(GroovyClassDoc[] classes)
      Build the class tree for the given documented classes. The returned root is a synthetic node for java.lang.Object; traits, interfaces, and annotation types are excluded (they belong in the interface tree).
    • buildInterfaceTree

      public static ClassTree.Node buildInterfaceTree(GroovyClassDoc[] classes)
      Build the interface tree for the given documented classes. Returns a synthetic top-level node whose children are the top-level interfaces/traits — i.e. those whose super-interfaces aren't themselves present in the input set.
    • sortedChildren

      public static List<ClassTree.Node> sortedChildren(ClassTree.Node node)
      Helper used by templates: list of children of a node, sorted by qualified name. Returns an empty list when node is null.