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

public static class AnnotatedTypeMirror.AnnotatedWildcardType extends 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).

  • Method Details

    • addAnnotation

      public void addAnnotation(AnnotationMirror annotation)
      Description copied from class: AnnotatedTypeMirror
      Adds the canonical version of annotation as a primary annotation of this type and, in the case of AnnotatedTypeMirror.AnnotatedTypeVariables, AnnotatedTypeMirror.AnnotatedWildcardTypes, and AnnotatedTypeMirror.AnnotatedIntersectionTypes, adds it to all bounds. (The canonical version is found via AnnotatedTypeFactory.canonicalAnnotation(javax.lang.model.element.AnnotationMirror).) If the canonical version of annotation is not a supported qualifier, then no annotation is added. If this type already has annotation in the same hierarchy as annotation, the behavior of this method is undefined.
      Overrides:
      addAnnotation in class AnnotatedTypeMirror
      Parameters:
      annotation - the annotation to add
    • getSuperBoundField

      public AnnotatedTypeMirror getSuperBoundField()
    • getSuperBound

      public AnnotatedTypeMirror getSuperBound()
      Returns the lower bound of this wildcard. If no lower bound is explicitly declared, returns an AnnotatedTypeMirror.AnnotatedNullType.
      Returns:
      the lower bound of this wildcard, or an AnnotatedTypeMirror.AnnotatedNullType if none is explicitly declared
    • getExtendsBoundField

      public AnnotatedTypeMirror getExtendsBoundField()
    • getExtendsBound

      public AnnotatedTypeMirror 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

      public TypeVariable 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

      public <R, P> R accept(AnnotatedTypeVisitor<R,P> v, P p)
      Description copied from class: AnnotatedTypeMirror
      Applies a visitor to this type.
      Specified by:
      accept in class AnnotatedTypeMirror
      Type Parameters:
      R - the return type of the visitor's methods
      P - the type of the additional parameter to the visitor's methods
      Parameters:
      v - the visitor operating on this type
      p - additional parameter to the visitor
      Returns:
      a visitor-specified result
    • getUnderlyingType

      public WildcardType getUnderlyingType()
      Description copied from class: AnnotatedTypeMirror
      Returns the underlying unannotated Java type, which this wraps.
      Overrides:
      getUnderlyingType in class AnnotatedTypeMirror
      Returns:
      the underlying type
    • deepCopy

      public AnnotatedTypeMirror.AnnotatedWildcardType deepCopy(boolean copyAnnotations)
      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:

      1. Structure preservation -- The exact structure of the original AnnotatedTypeMirror is preserved in the copy including all component types.
      2. Annotation preservation -- All of the annotations from the original AnnotatedTypeMirror and its components have been copied to the new type.
      If copyAnnotations is set to false, the second property, Annotation preservation, is removed. This is useful for cases in which the user may want to copy the structure of a type exactly but NOT its annotations.
      Specified by:
      deepCopy in class AnnotatedTypeMirror
      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 interface org.plumelib.util.DeepCopyable<AnnotatedTypeMirror>
      Specified by:
      deepCopy in class AnnotatedTypeMirror
      Returns:
      a deep copy of this type with annotations
      See Also:
    • shallowCopy

      public AnnotatedTypeMirror.AnnotatedWildcardType shallowCopy(boolean copyAnnotations)
      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 class AnnotatedTypeMirror
      Parameters:
      copyAnnotations - whether copy should have annotations, i.e. whether field annotations 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 class AnnotatedTypeMirror
      Returns:
      a shallow copy of this type with annotations
      See Also:
    • getErased

      public AnnotatedTypeMirror getErased()
      Description copied from class: AnnotatedTypeMirror
      Returns the erasure type of this type, according to JLS specifications.
      Overrides:
      getErased in class AnnotatedTypeMirror
      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