Class DefaultAnnotatedTypeFormatter
java.lang.Object
org.checkerframework.framework.type.DefaultAnnotatedTypeFormatter
- All Implemented Interfaces:
AnnotatedTypeFormatter
- Direct Known Subclasses:
NullnessAnnotatedTypeFormatter
,UnitsAnnotatedTypeFormatter
An AnnotatedTypeFormatter used by default by all AnnotatedTypeFactory (and therefore all
annotated types).
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
A scanning visitor that prints the entire AnnotatedTypeMirror passed to visit. -
Field Summary
Modifier and TypeFieldDescriptionprotected static final Map<TypeVariable,
Integer> Maps from type variables to deterministic IDs.protected final DefaultAnnotatedTypeFormatter.FormattingVisitor
The formatting visitor.protected static int
The last deterministic capture conversion ID that was used. -
Constructor Summary
ModifierConstructorDescriptionConstructs a DefaultAnnotatedTypeFormatter that does not print invisible annotations by default.DefaultAnnotatedTypeFormatter
(boolean printVerboseGenerics, boolean defaultPrintInvisibleAnnos) protected
Used by subclasses and other constructors to specify the underlying implementation of this DefaultAnnotatedTypeFormatter.DefaultAnnotatedTypeFormatter
(AnnotationFormatter formatter, boolean printVerboseGenerics, boolean defaultPrintInvisibleAnnos) -
Method Summary
Modifier and TypeMethodDescriptionformat
(AnnotatedTypeMirror type) Formats type into a String.format
(AnnotatedTypeMirror type, boolean printVerbose) Formats type into a String.
-
Field Details
-
formattingVisitor
The formatting visitor. -
captureConversionIds
Maps from type variables to deterministic IDs. This is useful for comparing output across two runs of the Checker Framework.This map is necessary for deterministic and informative output. javac might print two distinct capture-converted variables as "capture#222" if the second is created after the first is garbage-collected, or if they just happen to have the same hash code based on memory layout. Such javac output is misleading because it looks like the two printed representations refer to the same variable.
This map contains type variables that have been formatted. Therefore, the numbers may differ between Checker Framework runs if the different runs print different values (say, one of them prints more type variables than the other).
-
prevCaptureConversionId
protected static int prevCaptureConversionIdThe last deterministic capture conversion ID that was used.
-
-
Constructor Details
-
DefaultAnnotatedTypeFormatter
public DefaultAnnotatedTypeFormatter()Constructs a DefaultAnnotatedTypeFormatter that does not print invisible annotations by default. -
DefaultAnnotatedTypeFormatter
public DefaultAnnotatedTypeFormatter(boolean printVerboseGenerics, boolean defaultPrintInvisibleAnnos) - Parameters:
printVerboseGenerics
- for type parameters, their uses, and wildcards, print more informationdefaultPrintInvisibleAnnos
- whether or not this AnnotatedTypeFormatter should print invisible annotations
-
DefaultAnnotatedTypeFormatter
public DefaultAnnotatedTypeFormatter(AnnotationFormatter formatter, boolean printVerboseGenerics, boolean defaultPrintInvisibleAnnos) - Parameters:
formatter
- an object that converts annotation mirrors to stringsprintVerboseGenerics
- for type parameters, their uses, and wildcards, print more informationdefaultPrintInvisibleAnnos
- whether or not this AnnotatedTypeFormatter should print invisible annotations
-
DefaultAnnotatedTypeFormatter
Used by subclasses and other constructors to specify the underlying implementation of this DefaultAnnotatedTypeFormatter.
-
-
Method Details
-
format
Description copied from interface:AnnotatedTypeFormatter
Formats type into a String. Uses an implementation specific default for printing "invisible annotations"- Specified by:
format
in interfaceAnnotatedTypeFormatter
- Parameters:
type
- the type to be converted- Returns:
- a string representation of type
- See Also:
-
format
Description copied from interface:AnnotatedTypeFormatter
Formats type into a String.- Specified by:
format
in interfaceAnnotatedTypeFormatter
- Parameters:
type
- the type to be convertedprintVerbose
- whether or not to print verbosely- Returns:
- a string representation of type
- See Also:
-