Class QualifierDefaults.DefaultApplierElement
java.lang.Object
org.checkerframework.framework.util.defaults.QualifierDefaults.DefaultApplierElement
- Enclosing class:
QualifierDefaults
A default applier element.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AnnotatedTypeFactoryThe annotated type factory.protected final QualifierDefaults.DefaultApplierElementImplThe default element applier implementation.protected TypeUseLocationLocation to which to apply the default.protected final ElementThe scope of the default.protected final AnnotatedTypeMirrorThe type to which to apply the default. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultApplierElement(AnnotatedTypeFactory atypeFactory, Element scope, AnnotatedTypeMirror type, boolean applyToTypeVar) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAnnotation(AnnotatedTypeMirror type, AnnotationMirror qual) Add the qualifier to the type if it does not already have an annotation in the same hierarchy as qual.voidapplyDefault(Default def) Apply default to the type.protected booleanshouldBeAnnotated(AnnotatedTypeMirror type, boolean applyToTypeVar) Returns true if the given qualifier should be applied to the given type.
-
Field Details
-
atypeFactory
The annotated type factory. -
scope
The scope of the default. -
type
The type to which to apply the default. -
location
Location to which to apply the default. (Should only be set by the applyDefault method.) -
impl
The default element applier implementation.
-
-
Constructor Details
-
DefaultApplierElement
public DefaultApplierElement(AnnotatedTypeFactory atypeFactory, Element scope, AnnotatedTypeMirror type, boolean applyToTypeVar)
-
-
Method Details
-
applyDefault
Apply default to the type.- Parameters:
def- default to apply
-
shouldBeAnnotated
Returns true if the given qualifier should be applied to the given type. Currently we do not apply defaults to void types, packages, wildcards, and type variables.- Parameters:
type- type to which qual would be appliedapplyToTypeVar- whether to apply to type variables- Returns:
- true if this application should proceed
-
addAnnotation
Add the qualifier to the type if it does not already have an annotation in the same hierarchy as qual.- Parameters:
type- type to add qualqual- annotation to add
-