Class QualifierDefaults.DefaultApplierElement
java.lang.Object
org.checkerframework.framework.util.defaults.QualifierDefaults.DefaultApplierElement
- Enclosing class:
QualifierDefaults
A default applier element.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final AnnotatedTypeFactory
The annotated type factory.protected final boolean
Whether the element came from a tree.protected final QualifierDefaults.DefaultApplierElementImpl
The default element applier implementation.protected TypeUseLocation
Location to which to apply the default.protected final QualifierHierarchy
The qualifier hierarchy.protected final Element
The scope of the default.protected final AnnotatedTypeMirror
The type to which to apply the default. -
Constructor Summary
ConstructorDescriptionDefaultApplierElement
(AnnotatedTypeFactory atypeFactory, Element scope, AnnotatedTypeMirror type, boolean fromTree) Create an instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAnnotation
(AnnotatedTypeMirror type, AnnotationMirror qual) Add the qualifier to the type if it does not already have an annotation in the same hierarchy as qual.void
applyDefault
(Default def) Apply default to the type.protected boolean
Returns true if the given qualifier should be applied to the given type.
-
Field Details
-
atypeFactory
The annotated type factory. -
qualHierarchy
The qualifier hierarchy. -
scope
The scope of the default. -
type
The type to which to apply the default. -
fromTree
protected final boolean fromTreeWhether the element came from a tree. -
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 fromTree) Create an instance.- Parameters:
atypeFactory
- the type factoryscope
- the scope for the defaultstype
- the type to defaultfromTree
- whether the element came from a tree
-
-
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 applied- 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
-