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

public class InferenceType extends AbstractType
A type-like structure that contains at least one inference variable, but is not an inference variable.
  • Method Details

    • 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
    • create

      public static AbstractType create(AnnotatedTypeMirror type, TypeMirror typeMirror, @Nullable Theta map, Java8InferenceContext context)
      Creates an abstract type for the given TypeMirror. The created type is an InferenceType if type contains any type variables that are mapped to inference variables as specified by map. Or if type is a type variable that is mapped to an inference variable, that Variable is returned. Or if type contains no type variables that are mapped in an inference variable, a ProperType is returned.
      Parameters:
      type - the annotated type mirror
      typeMirror - the java type
      map - a mapping from type variable to inference variable
      context - the context
      Returns:
      the abstract type for the given TypeMirror and AnnotatedTypeMirror
    • create

      public static AbstractType create(AnnotatedTypeMirror type, TypeMirror typeMirror, @Nullable Theta map, AnnotationMirrorMap<QualifierVar> qualifierVars, Java8InferenceContext context)
      Creates an abstract type for the given TypeMirror. The created type is an InferenceType if type contains any type variables that are mapped to inference variables as specified by map. Or if type is a type variable that is mapped to an inference variable, that Variable is returned. Or if type contains no type variables that are mapped in an inference variable, a ProperType is returned.
      Parameters:
      type - the annotated type mirror
      typeMirror - the java type
      map - a mapping from type variable to inference variable
      qualifierVars - a mapping from polymorphic annotation to QualifierVar
      context - the context
      Returns:
      the abstract type for the given TypeMirror and AnnotatedTypeMirror
    • createIgnoreInstantiated

      public static AbstractType createIgnoreInstantiated(AnnotatedTypeMirror type, TypeMirror typeMirror, @Nullable Theta map, AnnotationMirrorMap<QualifierVar> qualifierVars, Java8InferenceContext context)
      Same as create(AnnotatedTypeMirror, TypeMirror, Theta, AnnotationMirrorMap, Java8InferenceContext), but if type contains any type variables that are in map, but already have an instantiation, they are treated as proper types.
      Parameters:
      type - the annotated type mirror
      typeMirror - the java type
      map - a mapping from type variable to inference variable
      qualifierVars - a mapping from polymorphic annotation to QualifierVar
      context - the context
      Returns:
      the abstract type for the given TypeMirror and AnnotatedTypeMirror
    • create

      public static List<AbstractType> create(List<AnnotatedTypeMirror> types, List<? extends TypeMirror> typeMirrors, Theta map, AnnotationMirrorMap<QualifierVar> qualifierVars, Java8InferenceContext context)
      Creates abstract types for each TypeMirror. The created type is an InferenceType if it contains any type variables that are mapped to inference variables as specified by map. Or if the type is a type variable that is mapped to an inference variable, it will return that Variable. Or if the type contains no type variables that are mapped in an inference variable, a ProperType is returned.
      Parameters:
      types - the annotated type mirrors
      typeMirrors - the java types
      map - a mapping from type variable to inference variable
      qualifierVars - a mapping from polymorphic annotation to QualifierVar
      context - the context
      Returns:
      the abstract type for the given TypeMirror and AnnotatedTypeMirror
    • create

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

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

      public int hashCode()
      Overrides:
      hashCode in class AbstractType
    • getJavaType

      public TypeMirror 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 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
    • 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
    • getInferenceVariables

      public Collection<Variable> getInferenceVariables()
      Returns all inference variables mentioned in this type.
      Specified by:
      getInferenceVariables in class AbstractType
      Returns:
      all inference variables mentioned in 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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
    • isSubType

      public ReductionResult isSubType(ProperType superType)
      Is this a subtype of superType?
      Parameters:
      superType - the potential supertype; is a declared type with no parameters
      Returns:
      if this is a subtype of superType, then return ConstraintSet.TRUE; otherwise, a false bound is returned