public class QualifierDefaults extends Object
DefaultQualifier
annotation.DefaultQualifier
Modifier and Type | Class and Description |
---|---|
protected static class |
QualifierDefaults.BoundType
Specifies whether the type variable or wildcard has an explicit upper bound (UPPER), an
explicit lower bound (LOWER), or no explicit bounds (UNBOUNDED).
|
protected class |
QualifierDefaults.DefaultApplierElement
A default applier element.
|
Modifier and Type | Field and Description |
---|---|
protected Map<Element,QualifierDefaults.BoundType> |
elementToBoundType
Mapping from an Element to the bound type.
|
static List<TypeUseLocation> |
STANDARD_CLIMB_DEFAULTS_BOTTOM
CLIMB locations whose standard default is bottom for a given type system.
|
static List<TypeUseLocation> |
STANDARD_CLIMB_DEFAULTS_TOP
CLIMB locations whose standard default is top for a given type system.
|
static List<TypeUseLocation> |
STANDARD_UNCHECKED_DEFAULTS_BOTTOM
Standard unchecked default locations that should be bottom.
|
static List<TypeUseLocation> |
STANDARD_UNCHECKED_DEFAULTS_TOP
Standard unchecked default locations that should be top.
|
Constructor and Description |
---|
QualifierDefaults(Elements elements,
AnnotatedTypeFactory atypeFactory) |
Modifier and Type | Method and Description |
---|---|
void |
addCheckedCodeDefault(AnnotationMirror absoluteDefaultAnno,
TypeUseLocation location)
Sets the default annotations.
|
void |
addCheckedCodeDefaults(AnnotationMirror absoluteDefaultAnno,
TypeUseLocation[] locations) |
void |
addClimbStandardDefaults()
Add standard CLIMB defaults that do not conflict with previously added defaults.
|
void |
addElementDefault(Element elem,
AnnotationMirror elementDefaultAnno,
TypeUseLocation location)
Sets the default annotations for a certain Element.
|
void |
addUncheckedCodeDefault(AnnotationMirror uncheckedDefaultAnno,
TypeUseLocation location)
Sets the default annotation for unchecked elements.
|
void |
addUncheckedCodeDefaults(AnnotationMirror absoluteDefaultAnno,
TypeUseLocation[] locations)
Sets the default annotation for unchecked elements, with specific locations.
|
void |
addUncheckedStandardDefaults()
Add standard unchecked defaults that do not conflict with previously added defaults.
|
void |
annotate(Element elt,
AnnotatedTypeMirror type)
Applies default annotations to a type given an
Element . |
void |
annotate(Tree tree,
AnnotatedTypeMirror type)
Applies default annotations to a type given a
Tree . |
boolean |
applyConservativeDefaults(Element annotationScope)
Given an element, returns whether the conservative default should be applied for it.
|
protected QualifierDefaults.DefaultApplierElement |
createDefaultApplierElement(AnnotatedTypeFactory atypeFactory,
Element annotationScope,
AnnotatedTypeMirror type,
boolean applyToTypeVar) |
QualifierDefaults.BoundType |
getWildcardBoundType(AnnotatedTypeMirror.AnnotatedWildcardType annotatedWildcard)
Returns the BoundType of annotatedWildcard.
|
boolean |
hasDefaultsForCheckedCode()
Check that a default with TypeUseLocation OTHERWISE or ALL is specified.
|
String |
toString() |
static List<TypeUseLocation> |
validLocationsForUncheckedCodeDefaults()
Returns an array of locations that are valid for the unchecked value defaults.
|
protected final Map<Element,QualifierDefaults.BoundType> elementToBoundType
public static final List<TypeUseLocation> STANDARD_CLIMB_DEFAULTS_TOP
public static final List<TypeUseLocation> STANDARD_CLIMB_DEFAULTS_BOTTOM
public static final List<TypeUseLocation> STANDARD_UNCHECKED_DEFAULTS_TOP
public static final List<TypeUseLocation> STANDARD_UNCHECKED_DEFAULTS_BOTTOM
public QualifierDefaults(Elements elements, AnnotatedTypeFactory atypeFactory)
elements
- interface to Element data in the current processing environmentatypeFactory
- an annotation factory, used to get annotations by namepublic static List<TypeUseLocation> validLocationsForUncheckedCodeDefaults()
public boolean hasDefaultsForCheckedCode()
public void addUncheckedStandardDefaults()
public void addClimbStandardDefaults()
public void addCheckedCodeDefault(AnnotationMirror absoluteDefaultAnno, TypeUseLocation location)
public void addUncheckedCodeDefault(AnnotationMirror uncheckedDefaultAnno, TypeUseLocation location)
public void addUncheckedCodeDefaults(AnnotationMirror absoluteDefaultAnno, TypeUseLocation[] locations)
public void addCheckedCodeDefaults(AnnotationMirror absoluteDefaultAnno, TypeUseLocation[] locations)
public void addElementDefault(Element elem, AnnotationMirror elementDefaultAnno, TypeUseLocation location)
public void annotate(Element elt, AnnotatedTypeMirror type)
Element
.elt
- the element from which the type was obtainedtype
- the type to annotatepublic void annotate(Tree tree, AnnotatedTypeMirror type)
Tree
.tree
- the tree from which the type was obtainedtype
- the type to annotatepublic boolean applyConservativeDefaults(Element annotationScope)
annotationScope
- the element that the conservative default might apply toprotected QualifierDefaults.DefaultApplierElement createDefaultApplierElement(AnnotatedTypeFactory atypeFactory, Element annotationScope, AnnotatedTypeMirror type, boolean applyToTypeVar)
public QualifierDefaults.BoundType getWildcardBoundType(AnnotatedTypeMirror.AnnotatedWildcardType annotatedWildcard)
annotatedWildcard
- the annotated wildcard type