checkers.util.test
Class TypeOutputtingChecker
java.lang.Object
javax.annotation.processing.AbstractProcessor
com.sun.source.util.AbstractTypeProcessor
checkers.source.SourceChecker
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
static class |
TypeOutputtingChecker.Visitor
Prints the types of the class and all of its enclosing
fields, methods, and inner classes |
| Methods inherited from class checkers.source.SourceChecker |
createFactory, getLintOption, getLintOption, getMessages, getProcessingEnvironment, getShouldSkip, getSupportedAnnotationTypes, getSupportedLintOptions, getSupportedOptions, getSupportedSourceVersion, getSuppressWarningsKey, init, message, report, typeProcess |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TypeOutputtingChecker
public TypeOutputtingChecker()
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