Class TypeOutputtingChecker
- java.lang.Object
-
- javax.annotation.processing.AbstractProcessor
-
- org.checkerframework.javacutil.AbstractTypeProcessor
-
- org.checkerframework.framework.source.SourceChecker
-
- org.checkerframework.common.basetype.BaseTypeChecker
-
- org.checkerframework.common.util.debug.TypeOutputtingChecker
-
- All Implemented Interfaces:
javax.annotation.processing.Processor
,OptionConfiguration
public class TypeOutputtingChecker extends BaseTypeChecker
A testing class that can be used to testTypeElement
. 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:
- Run the Checker on the source file like any checker:
java -processor org.checkerframework.common.util.debug.TypeOutputtingChecker [source-file]
- Run the Checker on the bytecode, by simply running the main and passing the qualified name,
e.g.
java org.checkerframework.common.util.debug.TypeOutputtingChecker [qualified-name]
- Apply a simple diff on the two outputs
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TypeOutputtingChecker.GeneralAnnotatedTypeFactory
Stores any explicit annotation in AnnotatedTypeMirrors.static class
TypeOutputtingChecker.Visitor
Prints the types of the class and all of its enclosing fields, methods, and inner classes.
-
Field Summary
-
Fields inherited from class org.checkerframework.framework.source.SourceChecker
currentRoot, DETAILS_SEPARATOR, elements, elementsWithSuppressedWarnings, errsOnLastExit, javacErrored, messager, messagesProperties, MSGS_FILE, OPTION_SEPARATOR, parentChecker, SUPPRESS_ALL_MESSAGE_KEY, SUPPRESS_ALL_PREFIX, treePathCacher, trees, types, UNNEEDED_SUPPRESSION_KEY, upstreamCheckerNames, useAllcheckersPrefix, visitor
-
-
Constructor Summary
Constructors Constructor Description TypeOutputtingChecker()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BaseTypeVisitor<?>
createSourceVisitor()
Returns the appropriate visitor that type-checks the compilation unit according to the type system rules.static void
main(java.lang.String[] args)
Main entry point.protected static void
printClassType(javax.lang.model.element.TypeElement typeElt, AnnotatedTypeFactory atypeFactory)
Prints the types of the class and all of its enclosing fields, methods, and inner classes.void
run(@CanonicalName java.lang.String[] args)
Run the test.-
Methods inherited from class org.checkerframework.common.basetype.BaseTypeChecker
createSourceVisitorPublic, getAnnotationProvider, getExtraStubFiles, getImmediateSubcheckerClasses, getOptions, getOptionsNoSubcheckers, getRelatedClassName, getSubchecker, getSubcheckers, getSupportedLintOptions, getSupportedOptions, getSuppressWarningsPrefixesOfSubcheckers, getTypeFactory, getTypeFactoryOfSubcheckerOrNull, getUltimateParentChecker, getVisitor, hasOptionNoSubcheckers, initChecker, invokeConstructorFor, printOrStoreMessage, processErrorMessageArg, setRoot, shouldAddShutdownHook, shouldResolveReflection, shutdownHook, typeProcess, typeProcessingOver, warnUnneededSuppressions
-
Methods inherited from class org.checkerframework.framework.source.SourceChecker
addOptions, createSupportedLintOptions, expandCFOptions, fullMessageOf, getBooleanOption, getBooleanOption, getElementUtils, getLintOption, getLintOption, getMessagesProperties, getOption, getOption, getOptionConfiguration, getParentChecker, getPathToCompilationUnit, getProcessingEnvironment, getProperties, getStandardSuppressWarningsPrefixes, getStringsOption, getStringsOption, getSupportedAnnotationTypes, getSupportedSourceVersion, getSuppressWarningsPrefixes, getTreePathCacher, getTreeUtils, getTypeUtils, getUpstreamCheckerNames, getWarningMessagePrefix, hasOption, init, message, message, messageKeyMatches, printOrStoreMessage, printStats, report, reportError, reportWarning, setLintOption, setParentChecker, setProcessingEnvironment, setSupportedLintOptions, shouldSkipDefs, shouldSkipDefs, shouldSkipUses, shouldSkipUses, shouldSuppressWarnings, shouldSuppressWarnings, shouldSuppressWarnings, typeProcessingStart, useConservativeDefault, warnUnneededSuppressions
-
Methods inherited from class org.checkerframework.javacutil.AbstractTypeProcessor
getCompilerLog, process
-
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
-
Methods inherited from interface org.checkerframework.framework.util.OptionConfiguration
getStringsOption, getStringsOption
-
-
-
-
Method Detail
-
createSourceVisitor
protected BaseTypeVisitor<?> createSourceVisitor()
Description copied from class:BaseTypeChecker
Returns the appropriate visitor that type-checks the compilation unit according to the type system rules.This implementation uses the checker naming convention to create the appropriate visitor. If no visitor is found, it returns an instance of
BaseTypeVisitor
. It reflectively invokes the constructor that accepts this checker and the compilation unit tree (in that order) as arguments.Subclasses have to override this method to create the appropriate visitor if they do not follow the checker naming convention.
- Overrides:
createSourceVisitor
in classBaseTypeChecker
- Returns:
- the type-checking visitor
-
main
public static void main(java.lang.String[] args)
Main entry point.- Parameters:
args
- command-line arguments
-
run
public void run(@CanonicalName java.lang.String[] args)
Run the test.- Parameters:
args
- command-line arguments
-
printClassType
protected static void printClassType(javax.lang.model.element.TypeElement typeElt, AnnotatedTypeFactory atypeFactory)
Prints the types of the class and all of its enclosing fields, methods, and inner classes.
-
-