Class QualifierDefaults
java.lang.Object
org.checkerframework.framework.util.defaults.QualifierDefaults
Determines the default qualifiers on a type. Default qualifiers are specified via the 
DefaultQualifier annotation.- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static enumSpecifies whether the type variable or wildcard has an explicit upper bound (UPPER), an explicit lower bound (LOWER), or no explicit bounds (UNBOUNDED).protected classA default applier element.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final ExecutableElementThe value() element/field of a @DefaultQualifier.List annotation.protected final ExecutableElementThe locations() element/field of a @DefaultQualifier annotation.protected final ExecutableElementThe value() element/field of a @DefaultQualifier annotation.protected final Map<Element,QualifierDefaults.BoundType> Mapping from an Element to the bound type.static final List<TypeUseLocation>CLIMB locations whose standard default is bottom for a given type system.static final List<TypeUseLocation>CLIMB locations whose standard default is top for a given type system.static final List<TypeUseLocation>Standard unchecked default locations that should be bottom.static final List<TypeUseLocation>Standard unchecked default locations that should be top.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddCheckedCodeDefault(AnnotationMirror absoluteDefaultAnno, TypeUseLocation location) Sets the default annotations.voidaddCheckedCodeDefaults(AnnotationMirror absoluteDefaultAnno, TypeUseLocation[] locations) voidAdd standard CLIMB defaults that do not conflict with previously added defaults.voidaddElementDefault(Element elem, AnnotationMirror elementDefaultAnno, TypeUseLocation location) Sets the default annotations for a certain Element.voidaddUncheckedCodeDefault(AnnotationMirror uncheckedDefaultAnno, TypeUseLocation location) Add a default annotation for unchecked elements.voidaddUncheckedCodeDefaults(AnnotationMirror absoluteDefaultAnno, TypeUseLocation[] locations) Sets the default annotation for unchecked elements, with specific locations.voidAdd standard unchecked defaults that do not conflict with previously added defaults.voidannotate(Tree tree, AnnotatedTypeMirror type) Applies default annotations to a type given aTree.voidannotate(Element elt, AnnotatedTypeMirror type) Applies default annotations to a type obtained from anElement.booleanapplyConservativeDefaults(Element annotationScope) Given an element, returns whether the conservative default should be applied for it.protected QualifierDefaults.DefaultApplierElementcreateDefaultApplierElement(AnnotatedTypeFactory atypeFactory, Element annotationScope, AnnotatedTypeMirror type, boolean applyToTypeVar) Returns the BoundType of annotatedWildcard.booleanCheck that a default with TypeUseLocation OTHERWISE or ALL is specified.toString()static List<TypeUseLocation>Returns an array of locations that are valid for the unchecked value defaults.
- 
Field Details- 
defaultQualifierValueElementThe value() element/field of a @DefaultQualifier annotation.
- 
defaultQualifierLocationsElementThe locations() element/field of a @DefaultQualifier annotation.
- 
defaultQualifierListValueElementThe value() element/field of a @DefaultQualifier.List annotation.
- 
elementToBoundTypeMapping from an Element to the bound type.
- 
STANDARD_CLIMB_DEFAULTS_TOPCLIMB locations whose standard default is top for a given type system.
- 
STANDARD_CLIMB_DEFAULTS_BOTTOMCLIMB locations whose standard default is bottom for a given type system.
- 
STANDARD_UNCHECKED_DEFAULTS_TOPStandard unchecked default locations that should be top.
- 
STANDARD_UNCHECKED_DEFAULTS_BOTTOMStandard unchecked default locations that should be bottom.
 
- 
- 
Constructor Details- 
QualifierDefaults- Parameters:
- elements- interface to Element data in the current processing environment
- atypeFactory- an annotation factory, used to get annotations by name
 
 
- 
- 
Method Details- 
validLocationsForUncheckedCodeDefaultsReturns an array of locations that are valid for the unchecked value defaults. These are simply by syntax, since an entire file is typechecked, it is not possible for local variables to be unchecked.
- 
toString
- 
hasDefaultsForCheckedCodepublic boolean hasDefaultsForCheckedCode()Check that a default with TypeUseLocation OTHERWISE or ALL is specified.- Returns:
- whether we found a Default with location OTHERWISE or ALL
 
- 
addUncheckedStandardDefaultspublic void addUncheckedStandardDefaults()Add standard unchecked defaults that do not conflict with previously added defaults.
- 
addClimbStandardDefaultspublic void addClimbStandardDefaults()Add standard CLIMB defaults that do not conflict with previously added defaults.
- 
addCheckedCodeDefaultSets the default annotations. A programmer may override this by writing the @DefaultQualifier annotation on an element.
- 
addUncheckedCodeDefaultpublic void addUncheckedCodeDefault(AnnotationMirror uncheckedDefaultAnno, TypeUseLocation location) Add a default annotation for unchecked elements.- Parameters:
- uncheckedDefaultAnno- the default annotation mirror
- location- the type use location
 
- 
addUncheckedCodeDefaultspublic void addUncheckedCodeDefaults(AnnotationMirror absoluteDefaultAnno, TypeUseLocation[] locations) Sets the default annotation for unchecked elements, with specific locations.
- 
addCheckedCodeDefaultspublic void addCheckedCodeDefaults(AnnotationMirror absoluteDefaultAnno, TypeUseLocation[] locations) 
- 
addElementDefaultpublic void addElementDefault(Element elem, AnnotationMirror elementDefaultAnno, TypeUseLocation location) Sets the default annotations for a certain Element.- Parameters:
- elem- the scope to set the default within
- elementDefaultAnno- the default to set
- location- the location to apply the default to
 
- 
annotateApplies default annotations to a type obtained from anElement.- Parameters:
- elt- the element from which the type was obtained
- type- the type to annotate
 
- 
annotateApplies default annotations to a type given aTree.- Parameters:
- tree- the tree from which the type was obtained
- type- the type to annotate
 
- 
applyConservativeDefaultsGiven an element, returns whether the conservative default should be applied for it. Handles elements from bytecode or source code.- Parameters:
- annotationScope- the element that the conservative default might apply to
- Returns:
- whether the conservative default applies to the given element
 
- 
createDefaultApplierElementprotected QualifierDefaults.DefaultApplierElement createDefaultApplierElement(AnnotatedTypeFactory atypeFactory, Element annotationScope, AnnotatedTypeMirror type, boolean applyToTypeVar) 
- 
getWildcardBoundTypepublic QualifierDefaults.BoundType getWildcardBoundType(AnnotatedTypeMirror.AnnotatedWildcardType wildcardType) Returns the BoundType of annotatedWildcard. If it is unbounded, use the type parameter to which its an argument.- Parameters:
- wildcardType- the annotated wildcard type
- Returns:
- the BoundType of annotatedWildcard. If it is unbounded, use the type parameter to which its an argument
 
 
-