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 booleanWhether the element came from a tree.protected final QualifierDefaults.DefaultApplierElementImplThe default element applier implementation.protected TypeUseLocationLocation to which to apply the default.protected final QualifierHierarchyThe qualifier hierarchy.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 fromTree) Create an instance. -
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 booleanReturns 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
-