Class AnnotatedTypeMirror.AnnotatedWildcardType
java.lang.Object
org.checkerframework.framework.type.AnnotatedTypeMirror
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedWildcardType
- All Implemented Interfaces:
org.plumelib.util.DeepCopyable<AnnotatedTypeMirror>
- Enclosing class:
- AnnotatedTypeMirror
Represents a wildcard type argument. Examples include:
? ? extends Number ? super T
A wildcard may have its upper bound explicitly set by an extends clause, its lower bound explicitly set by a super clause, or neither (but not both).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.framework.type.AnnotatedTypeMirror
AnnotatedTypeMirror.AnnotatedArrayType, AnnotatedTypeMirror.AnnotatedDeclaredType, AnnotatedTypeMirror.AnnotatedExecutableType, AnnotatedTypeMirror.AnnotatedIntersectionType, AnnotatedTypeMirror.AnnotatedNoType, AnnotatedTypeMirror.AnnotatedNullType, AnnotatedTypeMirror.AnnotatedPrimitiveType, AnnotatedTypeMirror.AnnotatedTypeVariable, AnnotatedTypeMirror.AnnotatedUnionType, AnnotatedTypeMirror.AnnotatedWildcardType
-
Field Summary
Fields inherited from class org.checkerframework.framework.type.AnnotatedTypeMirror
atypeFactory, EQUALITY_COMPARER, HASHCODE_VISITOR, primaryAnnotations, underlyingType
-
Method Summary
Modifier and TypeMethodDescription<R,
P> R accept
(AnnotatedTypeVisitor<R, P> v, P p) Applies a visitor to this type.void
addAnnotation
(AnnotationMirror annotation) Adds the canonical version ofannotation
as a primary annotation of this type and, in the case ofAnnotatedTypeMirror.AnnotatedTypeVariable
s,AnnotatedTypeMirror.AnnotatedWildcardType
s, andAnnotatedTypeMirror.AnnotatedIntersectionType
s, adds it to all bounds.deepCopy()
Returns a deep copy of this type with annotations.deepCopy
(boolean copyAnnotations) Returns a deep copy of this type.Returns the erasure type of this type, according to JLS specifications.Returns the upper bound of this wildcard.Returns the lower bound of this wildcard.Returns the type variable to which this wildcard is an argument.Returns the underlying unannotated Java type, which this wraps.boolean
Whether this is a type argument to a type whose#underlyingType
is raw.void
Sets the upper bound of this wildcard.void
Sets the super bound of this wildcard.void
Set that this wildcard is a type argument of a raw type.Returns a shallow copy of this type with annotations.shallowCopy
(boolean copyAnnotations) Returns a shallow copy of this type.Methods inherited from class org.checkerframework.framework.type.AnnotatedTypeMirror
addAnnotation, addAnnotations, addMissingAnnotation, addMissingAnnotations, asUse, clearAnnotations, clearPrimaryAnnotations, containsCapturedTypes, createType, createTypeOfObject, createTypeOfRecord, directSupertypes, equals, getAnnotation, getAnnotation, getAnnotation, getAnnotationInHierarchy, getAnnotations, getAnnotationsField, getEffectiveAnnotation, getEffectiveAnnotation, getEffectiveAnnotationInHierarchy, getEffectiveAnnotations, getExplicitAnnotations, getKind, getPrimaryAnnotation, getPrimaryAnnotation, getPrimaryAnnotation, getPrimaryAnnotationInHierarchy, getPrimaryAnnotations, getPrimaryAnnotationsField, getPrimitiveKind, getUnderlyingTypeHashCode, hasAnnotation, hasAnnotation, hasAnnotationInHierarchy, hasAnnotationRelaxed, hasEffectiveAnnotation, hasEffectiveAnnotation, hasEffectiveAnnotationRelaxed, hasExplicitAnnotation, hasExplicitAnnotation, hasExplicitAnnotationRelaxed, hashCode, hasPrimaryAnnotation, hasPrimaryAnnotation, hasPrimaryAnnotationInHierarchy, hasPrimaryAnnotationRelaxed, isAnnotatedInHierarchy, isDeclaration, removeAnnotation, removeAnnotationByClass, removeAnnotationInHierarchy, removeNonTopAnnotationInHierarchy, removePrimaryAnnotation, removePrimaryAnnotationByClass, removePrimaryAnnotationInHierarchy, removePrimaryAnnotations, replaceAnnotation, replaceAnnotations, toString, toString
-
Method Details
-
addAnnotation
Description copied from class:AnnotatedTypeMirror
Adds the canonical version ofannotation
as a primary annotation of this type and, in the case ofAnnotatedTypeMirror.AnnotatedTypeVariable
s,AnnotatedTypeMirror.AnnotatedWildcardType
s, andAnnotatedTypeMirror.AnnotatedIntersectionType
s, adds it to all bounds. (The canonical version is found viaAnnotatedTypeFactory.canonicalAnnotation(javax.lang.model.element.AnnotationMirror)
.) If the canonical version ofannotation
is not a supported qualifier, then no annotation is added. If this type already has annotation in the same hierarchy asannotation
, the behavior of this method is undefined.- Overrides:
addAnnotation
in classAnnotatedTypeMirror
- Parameters:
annotation
- the annotation to add
-
setSuperBound
Sets the super bound of this wildcard.- Parameters:
type
- the type of the lower bound
-
getSuperBoundField
-
getSuperBound
Returns the lower bound of this wildcard. If no lower bound is explicitly declared, returns anAnnotatedTypeMirror.AnnotatedNullType
.- Returns:
- the lower bound of this wildcard, or an
AnnotatedTypeMirror.AnnotatedNullType
if none is explicitly declared
-
setExtendsBound
Sets the upper bound of this wildcard.- Parameters:
type
- the type of the upper bound
-
getExtendsBoundField
-
getExtendsBound
Returns the upper bound of this wildcard. If no upper bound is explicitly declared, returns the upper bound of the type variable to which the wildcard is bound.- Returns:
- the upper bound of this wildcard. If no upper bound is explicitly declared, returns the upper bound of the type variable to which the wildcard is bound.
-
getTypeVariable
Returns the type variable to which this wildcard is an argument. Used to initialize the upper bound of wildcards in raw types.- Returns:
- the type variable to which this wildcard is an argument
-
accept
Description copied from class:AnnotatedTypeMirror
Applies a visitor to this type.- Specified by:
accept
in classAnnotatedTypeMirror
- Type Parameters:
R
- the return type of the visitor's methodsP
- the type of the additional parameter to the visitor's methods- Parameters:
v
- the visitor operating on this typep
- additional parameter to the visitor- Returns:
- a visitor-specified result
-
getUnderlyingType
Description copied from class:AnnotatedTypeMirror
Returns the underlying unannotated Java type, which this wraps.- Overrides:
getUnderlyingType
in classAnnotatedTypeMirror
- Returns:
- the underlying type
-
deepCopy
Description copied from class:AnnotatedTypeMirror
Returns a deep copy of this type. A deep copy implies that each component type is copied recursively and the returned type refers to those copies in its component locations.Note: deepCopy provides two important properties in the returned copy:
- Structure preservation -- The exact structure of the original AnnotatedTypeMirror is preserved in the copy including all component types.
- Annotation preservation -- All of the annotations from the original AnnotatedTypeMirror and its components have been copied to the new type.
- Specified by:
deepCopy
in classAnnotatedTypeMirror
- Returns:
- a deep copy
-
deepCopy
Description copied from class:AnnotatedTypeMirror
Returns a deep copy of this type with annotations.Each subclass implements this method with the subclass return type. The method body must always be a call to deepCopy(true).
- Specified by:
deepCopy
in interfaceorg.plumelib.util.DeepCopyable<AnnotatedTypeMirror>
- Specified by:
deepCopy
in classAnnotatedTypeMirror
- Returns:
- a deep copy of this type with annotations
- See Also:
-
shallowCopy
Description copied from class:AnnotatedTypeMirror
Returns a shallow copy of this type. A shallow copy implies that each component type in the output copy refers to the same object as the object being copied.- Specified by:
shallowCopy
in classAnnotatedTypeMirror
- Parameters:
copyAnnotations
- whether copy should have annotations, i.e. whether fieldannotations
should be copied.
-
shallowCopy
Description copied from class:AnnotatedTypeMirror
Returns a shallow copy of this type with annotations.Each subclass implements this method with the subclass return type. The method body must always be a call to shallowCopy(true).
- Specified by:
shallowCopy
in classAnnotatedTypeMirror
- Returns:
- a shallow copy of this type with annotations
- See Also:
-
getErased
Description copied from class:AnnotatedTypeMirror
Returns the erasure type of this type, according to JLS specifications.- Overrides:
getErased
in classAnnotatedTypeMirror
- Returns:
- the erasure of this AnnotatedTypeMirror, this is always a copy even if the erasure and the original type are equivalent
- See Also:
-
setTypeArgOfRawType
public void setTypeArgOfRawType()Set that this wildcard is a type argument of a raw type. -
isTypeArgOfRawType
public boolean isTypeArgOfRawType()Whether this is a type argument to a type whose#underlyingType
is raw. The Checker Framework gives raw types wildcard type arguments so that the annotated type can be used as if the annotated type was not raw.- Returns:
- whether this is a type argument to a type whose
#underlyingType
is raw
-