Class DefaultAnnotatedTypeFormatter.FormattingVisitor
java.lang.Object
org.checkerframework.framework.type.DefaultAnnotatedTypeFormatter.FormattingVisitor
- All Implemented Interfaces:
AnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>>
- Direct Known Subclasses:
NullnessAnnotatedTypeFormatter.NullnessFormattingVisitor
,UnitsAnnotatedTypeFormatter.UnitsFormattingVisitor
- Enclosing class:
- DefaultAnnotatedTypeFormatter
protected static class DefaultAnnotatedTypeFormatter.FormattingVisitor
extends Object
implements AnnotatedTypeVisitor<String,Set<AnnotatedTypeMirror>>
A scanning visitor that prints the entire AnnotatedTypeMirror passed to visit.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final AnnotationFormatter
The object responsible for converting annotations to strings.protected boolean
Whether the visitor is currently printing a raw type.protected boolean
For a given call to format, this setting specifies whether or not to printInvisibles.protected boolean
Prints type variables in a less ambiguous manner using [] to delimit them.protected final boolean
Represents whether or not invisible annotations should be printed if the client of this class does not use the printInvisibleAnnos parameter.protected final boolean
Default value of currentPrintVerboseGenerics. -
Constructor Summary
ConstructorDescriptionFormattingVisitor
(AnnotationFormatter annoFormatter, boolean printVerboseGenerics, boolean defaultInvisiblesSetting) Creates the visitor. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
formatFlatType
(AnnotatedTypeMirror flatType) protected void
printBound
(String keyWord, AnnotatedTypeMirror field, Set<AnnotatedTypeMirror> visiting, StringBuilder sb) Print, to sb,keyWord
followed byfield
.protected void
Set verbose settings to the default.protected void
setVerboseSettings
(boolean printVerbose) Set the current verbose settings to use while printing.visit
(AnnotatedTypeMirror type) A convenience method equivalent tov.visit(t, null)
.visit
(AnnotatedTypeMirror type, Set<AnnotatedTypeMirror> annotatedTypeVariables) Visits a type.visitArray
(AnnotatedTypeMirror.AnnotatedArrayType type, Set<AnnotatedTypeMirror> visiting) Visits an array type.visitDeclared
(AnnotatedTypeMirror.AnnotatedDeclaredType type, Set<AnnotatedTypeMirror> visiting) Visits a declared type.visitExecutable
(AnnotatedTypeMirror.AnnotatedExecutableType type, Set<AnnotatedTypeMirror> visiting) Visits an executable type.visitIntersection
(AnnotatedTypeMirror.AnnotatedIntersectionType type, Set<AnnotatedTypeMirror> visiting) Visits an intersection type.visitNoType
(AnnotatedTypeMirror.AnnotatedNoType type, Set<AnnotatedTypeMirror> visiting) Visits NoType type.visitNull
(AnnotatedTypeMirror.AnnotatedNullType type, Set<AnnotatedTypeMirror> visiting) Visits anull
type.visitPrimitive
(AnnotatedTypeMirror.AnnotatedPrimitiveType type, Set<AnnotatedTypeMirror> visiting) Visits a primitive type.visitTypeVariable
(AnnotatedTypeMirror.AnnotatedTypeVariable type, Set<AnnotatedTypeMirror> visiting) Visits a type variable.visitUnion
(AnnotatedTypeMirror.AnnotatedUnionType type, Set<AnnotatedTypeMirror> visiting) Visits an union type.visitWildcard
(AnnotatedTypeMirror.AnnotatedWildcardType type, Set<AnnotatedTypeMirror> visiting) Visits a wildcard type.
-
Field Details
-
annoFormatter
The object responsible for converting annotations to strings. -
defaultInvisiblesSetting
protected final boolean defaultInvisiblesSettingRepresents whether or not invisible annotations should be printed if the client of this class does not use the printInvisibleAnnos parameter. -
currentPrintInvisibleSetting
protected boolean currentPrintInvisibleSettingFor a given call to format, this setting specifies whether or not to printInvisibles. If a user did not specify a printInvisible parameter in the call to format then this value will equal DefaultAnnotatedTypeFormatter.defaultInvisibleSettings for this object -
defaultPrintVerboseGenerics
protected final boolean defaultPrintVerboseGenericsDefault value of currentPrintVerboseGenerics. -
currentPrintVerboseGenerics
protected boolean currentPrintVerboseGenericsPrints type variables in a less ambiguous manner using [] to delimit them. Always prints both bounds even if they lower bound is an AnnotatedNull type. -
currentlyPrintingRaw
protected boolean currentlyPrintingRawWhether the visitor is currently printing a raw type.
-
-
Constructor Details
-
FormattingVisitor
public FormattingVisitor(AnnotationFormatter annoFormatter, boolean printVerboseGenerics, boolean defaultInvisiblesSetting) Creates the visitor.- Parameters:
annoFormatter
- formatter used forAnnotationMirror
sprintVerboseGenerics
- whether to verbosely print type variables and wildcardsdefaultInvisiblesSetting
- whether to print invisible qualifiers
-
-
Method Details
-
setVerboseSettings
protected void setVerboseSettings(boolean printVerbose) Set the current verbose settings to use while printing. -
resetPrintVerboseSettings
protected void resetPrintVerboseSettings()Set verbose settings to the default. -
printBound
@SideEffectFree protected void printBound(String keyWord, AnnotatedTypeMirror field, Set<AnnotatedTypeMirror> visiting, StringBuilder sb) Print, to sb,keyWord
followed byfield
. NULL types are substituted with their annotations followed by " Void" -
visit
Description copied from interface:AnnotatedTypeVisitor
A convenience method equivalent tov.visit(t, null)
.- Specified by:
visit
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visit- Returns:
- a visitor-specified result
-
visit
Description copied from interface:AnnotatedTypeVisitor
Visits a type.- Specified by:
visit
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitannotatedTypeVariables
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitDeclared
public String visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType type, Set<AnnotatedTypeMirror> visiting) Description copied from interface:AnnotatedTypeVisitor
Visits a declared type.- Specified by:
visitDeclared
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitvisiting
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitIntersection
public String visitIntersection(AnnotatedTypeMirror.AnnotatedIntersectionType type, Set<AnnotatedTypeMirror> visiting) Description copied from interface:AnnotatedTypeVisitor
Visits an intersection type.- Specified by:
visitIntersection
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitvisiting
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitUnion
public String visitUnion(AnnotatedTypeMirror.AnnotatedUnionType type, Set<AnnotatedTypeMirror> visiting) Description copied from interface:AnnotatedTypeVisitor
Visits an union type.- Specified by:
visitUnion
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitvisiting
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitExecutable
public String visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type, Set<AnnotatedTypeMirror> visiting) Description copied from interface:AnnotatedTypeVisitor
Visits an executable type.- Specified by:
visitExecutable
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitvisiting
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitArray
public String visitArray(AnnotatedTypeMirror.AnnotatedArrayType type, Set<AnnotatedTypeMirror> visiting) Description copied from interface:AnnotatedTypeVisitor
Visits an array type.- Specified by:
visitArray
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitvisiting
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitTypeVariable
public String visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type, Set<AnnotatedTypeMirror> visiting) Description copied from interface:AnnotatedTypeVisitor
Visits a type variable.- Specified by:
visitTypeVariable
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitvisiting
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitPrimitive
@SideEffectFree public String visitPrimitive(AnnotatedTypeMirror.AnnotatedPrimitiveType type, Set<AnnotatedTypeMirror> visiting) Description copied from interface:AnnotatedTypeVisitor
Visits a primitive type.- Specified by:
visitPrimitive
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitvisiting
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitNoType
@SideEffectFree public String visitNoType(AnnotatedTypeMirror.AnnotatedNoType type, Set<AnnotatedTypeMirror> visiting) Description copied from interface:AnnotatedTypeVisitor
Visits NoType type.- Specified by:
visitNoType
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitvisiting
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitNull
@SideEffectFree public String visitNull(AnnotatedTypeMirror.AnnotatedNullType type, Set<AnnotatedTypeMirror> visiting) Description copied from interface:AnnotatedTypeVisitor
Visits anull
type.- Specified by:
visitNull
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitvisiting
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitWildcard
public String visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType type, Set<AnnotatedTypeMirror> visiting) Description copied from interface:AnnotatedTypeVisitor
Visits a wildcard type.- Specified by:
visitWildcard
in interfaceAnnotatedTypeVisitor<String,
Set<AnnotatedTypeMirror>> - Parameters:
type
- the type to visitvisiting
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
formatFlatType
-