java.lang.Object
org.checkerframework.framework.util.typeinference8.types.AbstractType
org.checkerframework.framework.util.typeinference8.types.UseOfVariable

public class UseOfVariable extends AbstractType
A use of an inference variable. This class keeps track of whether the use of this variable has a primary annotation.
  • Constructor Details

  • Method Details

    • create

      public AbstractType create(AnnotatedTypeMirror atm, TypeMirror type)
      Description copied from class: AbstractType
      Creates a type using the given types.
      Specified by:
      create in class AbstractType
      Parameters:
      atm - annotated type mirror
      type - type mirror
      Returns:
      the new type
    • isObject

      public boolean isObject()
      Description copied from class: AbstractType
      Return true if this type is java.lang.Object.
      Specified by:
      isObject in class AbstractType
      Returns:
      true if this type is java.lang.Object
    • getTypeParameterBounds

      public List<ProperType> getTypeParameterBounds()
      Description copied from class: AbstractType
      Assuming the type is a declared type, this method returns the upper bounds of its type parameters. (A type parameter of a declared type, can't refer to any type being inferred, so they are proper types.)
      Overrides:
      getTypeParameterBounds in class AbstractType
      Returns:
      the upper bounds of the type parameter of this type
    • capture

      public UseOfVariable capture(Java8InferenceContext context)
      Description copied from class: AbstractType
      Return a new type that is the capture of this type.
      Overrides:
      capture in class AbstractType
      Parameters:
      context - the context object
      Returns:
      a new type that is the capture of this type
    • getErased

      public UseOfVariable getErased()
      Description copied from class: AbstractType
      Return new type whose Java type is the erasure of this type.
      Overrides:
      getErased in class AbstractType
      Returns:
      a new type whose Java type is the erasure of this type
    • getJavaType

      public TypeVariable getJavaType()
      Description copied from class: AbstractType
      Return the underlying Java type without inference variables.
      Specified by:
      getJavaType in class AbstractType
      Returns:
      the underlying Java type without inference variables
    • getAnnotatedType

      public AnnotatedTypeMirror.AnnotatedTypeVariable getAnnotatedType()
      Description copied from class: AbstractType
      Return the underlying Java type without inference variables.
      Specified by:
      getAnnotatedType in class AbstractType
      Returns:
      the underlying Java type without inference variables
    • getKind

      public AbstractType.Kind getKind()
      Description copied from class: AbstractType
      Returns the kind of AbstractType.
      Specified by:
      getKind in class AbstractType
      Returns:
      the kind of AbstractType
    • getInferenceVariables

      public Collection<Variable> getInferenceVariables()
      Description copied from class: AbstractType
      Return a collection of all inference variables referenced by this type.
      Specified by:
      getInferenceVariables in class AbstractType
      Returns:
      a collection of all inference variables referenced by this type
    • applyInstantiations

      public AbstractType applyInstantiations()
      Description copied from class: AbstractType
      Return a new type that is the same as this one except the variables in instantiations have been replaced by their instantiation.
      Specified by:
      applyInstantiations in class AbstractType
      Returns:
      a new type that is the same as this one except the variables in instantiations have been replaced by their instantiation
    • getVariable

      public Variable getVariable()
      Returns the variable that this is a use of.
      Returns:
      the variable that this is a use of
    • setHasThrowsBound

      public void setHasThrowsBound(boolean hasThrowsBound)
      Set whether this use has a throws bound.
      Parameters:
      hasThrowsBound - whether this use has a throws bound
    • addQualifierBound

      public void addQualifierBound(VariableBounds.BoundKind kind, Set<AbstractQualifier> annotations)
      Adds a qualifier bound for this variable, is this use does not have a primary annotation.
      Parameters:
      kind - the kind of bound
      annotations - the qualifiers to add
    • addBound

      public void addBound(VariableBounds.BoundKind kind, AbstractType bound)
      Adds a bound for this variable, is this use does not have a primary annotation.
      Parameters:
      kind - the kind of bound
      bound - the type of the bound
    • getQualifiers

      public Set<AbstractQualifier> getQualifiers()
      Description copied from class: AbstractType
      Returns the primary qualifiers on this type.
      Specified by:
      getQualifiers in class AbstractType
      Returns:
      the primary qualifiers on this type
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class AbstractType
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractType