Class QualifierDefaults.DefaultApplierElement
- java.lang.Object
-
- org.checkerframework.framework.util.defaults.QualifierDefaults.DefaultApplierElement
-
- Enclosing class:
- QualifierDefaults
protected class QualifierDefaults.DefaultApplierElement extends java.lang.Object
A default applier element.
-
-
Field Summary
Fields Modifier and Type Field Description protected AnnotatedTypeFactory
atypeFactory
The annotated type factory.protected QualifierDefaults.DefaultApplierElementImpl
impl
The default element applier implementation.protected TypeUseLocation
location
Location to which to apply the default.protected javax.lang.model.element.Element
scope
The scope of the default.protected AnnotatedTypeMirror
type
The type to which to apply the default.
-
Constructor Summary
Constructors Constructor Description DefaultApplierElement(AnnotatedTypeFactory atypeFactory, javax.lang.model.element.Element scope, AnnotatedTypeMirror type, boolean applyToTypeVar)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAnnotation(AnnotatedTypeMirror type, javax.lang.model.element.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
shouldBeAnnotated(AnnotatedTypeMirror type, boolean applyToTypeVar)
Returns true if the given qualifier should be applied to the given type.
-
-
-
Field Detail
-
atypeFactory
protected final AnnotatedTypeFactory atypeFactory
The annotated type factory.
-
scope
protected final javax.lang.model.element.Element scope
The scope of the default.
-
type
protected final AnnotatedTypeMirror type
The type to which to apply the default.
-
location
protected TypeUseLocation location
Location to which to apply the default. (Should only be set by the applyDefault method.)
-
impl
protected final QualifierDefaults.DefaultApplierElementImpl impl
The default element applier implementation.
-
-
Constructor Detail
-
DefaultApplierElement
public DefaultApplierElement(AnnotatedTypeFactory atypeFactory, javax.lang.model.element.Element scope, AnnotatedTypeMirror type, boolean applyToTypeVar)
-
-
Method Detail
-
applyDefault
public void applyDefault(Default def)
Apply default to the type.- Parameters:
def
- default to apply
-
shouldBeAnnotated
protected boolean shouldBeAnnotated(AnnotatedTypeMirror type, boolean applyToTypeVar)
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
protected void addAnnotation(AnnotatedTypeMirror type, javax.lang.model.element.AnnotationMirror qual)
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
-
-