checkers.util.debug
Class TreeDebug

java.lang.Object
  extended by javax.annotation.processing.AbstractProcessor
      extended by checkers.source.SourceChecker
          extended by checkers.util.debug.TreeDebug
All Implemented Interfaces:
Processor

@SupportedSourceVersion(value=RELEASE_7)
public class TreeDebug
extends SourceChecker

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.

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).


Nested Class Summary
 class TreeDebug.Visitor
           
 
Field Summary
 
Fields inherited from class checkers.source.SourceChecker
currentRoot, env, messager, messages, skipPattern, trees
 
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
 
Constructor Summary
TreeDebug()
           
 
Method Summary
protected  boolean attribute(Set<? extends TypeElement> elements)
          No need for type-checking.
protected  SourceVisitor<?,?> createSourceVisitor(CompilationUnitTree root)
          Provides the SourceVisitor that the checker should use to scan input source trees.
 Properties getMessages()
          Provides a mapping of error keys to custom error messages.
 
Methods inherited from class checkers.source.SourceChecker
createFactory, getLintOption, getLintOption, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, init, message, process, report, shouldSkip
 
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, 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

getMessages

public Properties getMessages()
Description copied from class: SourceChecker
Provides a mapping of error keys to custom error messages. As a default, this implementation builds a Properties out of file messages.properties. It accumulates all the properties files in the Java class hierarchy from the checker up to SourceChecker. This permits subclasses to inherit default messages while being able to override them.

Overrides:
getMessages in class SourceChecker
Returns:
a Properties that maps error keys to error message text

attribute

protected boolean attribute(Set<? extends TypeElement> elements)
No need for type-checking. Elemenates need for setting all classpaths

Overrides:
attribute in class SourceChecker
Returns:
true iff if the code type-checks with Java Specification

createSourceVisitor

protected SourceVisitor<?,?> createSourceVisitor(CompilationUnitTree root)
Description copied from class: SourceChecker
Provides the SourceVisitor that the checker should use to scan input source trees.

Specified by:
createSourceVisitor in class SourceChecker
Parameters:
root - the AST root
Returns:
a SourceVisitor to use to scan source trees