Class TreeDebug

  • All Implemented Interfaces:
    javax.annotation.processing.Processor

    @SupportedAnnotationTypes("*")
    @SupportedSourceVersion(RELEASE_8)
    public class TreeDebug
    extends javax.annotation.processing.AbstractProcessor
    A utility class for displaying the structure of the AST of a program.

    The class is actually an annotation processor; in order to use it, invoke the compiler on the source file(s) for which you wish to view the structure of the program. You may also wish to use the -proc:only javac option to stop compilation after annotation processing. (But, in general -proc:only causes type annotation processors not to be run.)

    The utility will display the Tree.Kind of each node it encounters while scanning the AST, indented according to its depth in the tree. Additionally, the names of identifiers and member selection trees are displayed (since these names are not tree nodes and therefore not directly visited during AST traversal).

    See Also:
    TreePrinter
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TreeDebug.Visitor  
    • Field Summary

      • Fields inherited from class javax.annotation.processing.AbstractProcessor

        processingEnv
    • Constructor Summary

      Constructors 
      Constructor Description
      TreeDebug()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected TreeDebug.Visitor createSourceVisitor​(com.sun.source.tree.CompilationUnitTree root)  
      boolean process​(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations, javax.annotation.processing.RoundEnvironment roundEnv)  
      • Methods inherited from class javax.annotation.processing.AbstractProcessor

        getCompletions, getSupportedAnnotationTypes, getSupportedOptions, getSupportedSourceVersion, init, isInitialized
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TreeDebug

        public TreeDebug()
    • Method Detail

      • createSourceVisitor

        protected TreeDebug.Visitor createSourceVisitor​(com.sun.source.tree.CompilationUnitTree root)
      • process

        public boolean process​(java.util.Set<? extends javax.lang.model.element.TypeElement> annotations,
                               javax.annotation.processing.RoundEnvironment roundEnv)
        Specified by:
        process in interface javax.annotation.processing.Processor
        Specified by:
        process in class javax.annotation.processing.AbstractProcessor