checkers.util.test
Class TypeOutputtingChecker

java.lang.Object
  extended by javax.annotation.processing.AbstractProcessor
      extended by com.sun.source.util.AbstractTypeProcessor
          extended by checkers.source.SourceChecker
              extended by checkers.util.test.TypeOutputtingChecker
All Implemented Interfaces:
Processor

public class TypeOutputtingChecker
extends SourceChecker

A testing class that can be used to test TypeElement. In particular it tests that the types read from classfiles are the same to the ones from java files. For testing, you need to do the following: 1. Run the Checker on the source file like any checker:


      java -processor checkers.util.test.TypeOutputtingChecker [source-file]
    
2. Run the Checker on the bytecode, by simply running the main and passing the qualified name, e.g.

      java checkers.util.test.TypeOutputtingChecker [qualified-name]
    
3. Apply a simple diff on the two outputs


Nested Class Summary
Modifier and Type Class and Description
static class TypeOutputtingChecker.Visitor
          Prints the types of the class and all of its enclosing fields, methods, and inner classes
 
Field Summary
Modifier and Type Field and Description
 
Fields inherited from class checkers.source.SourceChecker
currentPath, currentRoot, env, messager, messages, trees
 
Fields inherited from class javax.annotation.processing.AbstractProcessor
processingEnv
 
Constructor Summary
Constructor and Description
TypeOutputtingChecker()
           
 
Method Summary
Modifier and Type Method and Description
protected  SourceVisitor<?,?> createSourceVisitor(CompilationUnitTree root)
          Provides the SourceVisitor that the checker should use to scan input source trees.
static void main(String[] args)
           
protected static void printClassType(TypeElement typeElt, AnnotatedTypeFactory atypeFactory)
          Prints the types of the class and all of its enclosing fields, methods, and inner classes
 
Methods inherited from class checkers.source.SourceChecker
createFactory, fullMessageOf, getLintOption, getLintOption, getMessages, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, init, message, report, typeProcess
 
Methods inherited from class com.sun.source.util.AbstractTypeProcessor
process, typeProcessingOver
 
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

TypeOutputtingChecker

public TypeOutputtingChecker()
Method Detail

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

main

public static void main(String[] args)

printClassType

protected static void printClassType(TypeElement typeElt,
                                     AnnotatedTypeFactory atypeFactory)
Prints the types of the class and all of its enclosing fields, methods, and inner classes