Class AnnotatedTypeMirror.AnnotatedWildcardType
java.lang.Object
org.checkerframework.framework.type.AnnotatedTypeMirror
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedWildcardType
- All Implemented Interfaces:
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
annotations, atypeFactory, EQUALITY_COMPARER, HASHCODE_VISITOR, underlyingType -
Method Summary
Modifier and TypeMethodDescription<R,P> R accept(AnnotatedTypeVisitor<R, P> v, P p) Applies a visitor to this type.voidAdds an annotation to this type.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 the 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.booleanReturns whether or not this wildcard is a type argument for which inference failed to infer a type.voidSet that this wildcard is from an uninferred type argument.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, addMissingAnnotations, asUse, clearPrimaryAnnotations, containsUninferredTypeArguments, createType, createTypeOfObject, directSupertypes, equals, getAnnotation, getAnnotation, getAnnotation, getAnnotationInHierarchy, getAnnotations, getAnnotationsField, getEffectiveAnnotation, getEffectiveAnnotationInHierarchy, getEffectiveAnnotations, getExplicitAnnotations, getKind, getPrimitiveKind, getUnderlyingTypeHashCode, hasAnnotation, hasAnnotation, hasAnnotationRelaxed, hasEffectiveAnnotation, hasEffectiveAnnotation, hasEffectiveAnnotationRelaxed, hasExplicitAnnotation, hasExplicitAnnotation, hasExplicitAnnotationRelaxed, hashCode, isAnnotatedInHierarchy, isDeclaration, removeAnnotation, removeAnnotationByClass, removeAnnotationInHierarchy, removeAnnotations, removeNonTopAnnotationInHierarchy, replaceAnnotation, replaceAnnotations, toString, toString
-
Method Details
-
addAnnotation
Description copied from class:AnnotatedTypeMirrorAdds an annotation to this type. Only annotations supported by the type factory are added.- Overrides:
addAnnotationin classAnnotatedTypeMirror- Parameters:
a- the annotation to add
-
getSuperBoundField
-
getSuperBound
Returns the lower bound of this wildcard. If no lower bound is explicitly declared, returnsnull.- Returns:
- the lower bound of this wildcard, or null if none is explicitly declared
-
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:AnnotatedTypeMirrorApplies a visitor to this type.- Specified by:
acceptin 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:AnnotatedTypeMirrorReturns the underlying unannotated Java type, which this wraps.- Overrides:
getUnderlyingTypein classAnnotatedTypeMirror- Returns:
- the underlying type
-
deepCopy
Description copied from class:AnnotatedTypeMirrorReturns 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:
deepCopyin classAnnotatedTypeMirror- Returns:
- a deep copy
-
deepCopy
Description copied from class:AnnotatedTypeMirrorReturns 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:
deepCopyin interfaceDeepCopyable<AnnotatedTypeMirror>- Specified by:
deepCopyin classAnnotatedTypeMirror- Returns:
- a deep copy of this type with annotations
- See Also:
-
shallowCopy
Description copied from class:AnnotatedTypeMirrorReturns 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:
shallowCopyin classAnnotatedTypeMirror- Parameters:
copyAnnotations- whether copy should have annotations, i.e. whether fieldannotationsshould be copied.
-
shallowCopy
Description copied from class:AnnotatedTypeMirrorReturns 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:
shallowCopyin classAnnotatedTypeMirror- Returns:
- a shallow copy of this type with annotations
- See Also:
-
getErased
Description copied from class:AnnotatedTypeMirrorReturns the erasure type of the this type, according to JLS specifications.- Overrides:
getErasedin classAnnotatedTypeMirror- Returns:
- the erasure of this AnnotatedTypeMirror, this is always a copy even if the erasure and the original type are equivalent
- See Also:
-
setUninferredTypeArgument
public void setUninferredTypeArgument()Set that this wildcard is from an uninferred type argument. This method should only be used within the framework. Once issues that depend on this hack, in particular Issue 979, are fixed, this must be removed. -
isUninferredTypeArgument
public boolean isUninferredTypeArgument()Returns whether or not this wildcard is a type argument for which inference failed to infer a type.- Returns:
- true if this wildcard is a type argument for which inference failed
-