Class InferenceType
java.lang.Object
org.checkerframework.framework.util.typeinference8.types.AbstractType
org.checkerframework.framework.util.typeinference8.types.InferenceType
A type-like structure that contains at least one inference variable, but is not an inference
variable.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.framework.util.typeinference8.types.AbstractType
AbstractType.Kind -
Field Summary
Fields inherited from class org.checkerframework.framework.util.typeinference8.types.AbstractType
context, ignoreAnnotations, typeFactory -
Method Summary
Modifier and TypeMethodDescriptionReturn a new type that is the same as this one except the variables ininstantiationshave been replaced by their instantiation.static List<AbstractType> create(List<AnnotatedTypeMirror> types, List<? extends TypeMirror> typeMirrors, Theta map, AnnotationMirrorMap<QualifierVar> qualifierVars, Java8InferenceContext context) Creates abstract types for each TypeMirror.create(AnnotatedTypeMirror type, TypeMirror typeMirror, boolean ignoreAnnotations) Creates a type using the given types.static AbstractTypecreate(AnnotatedTypeMirror type, TypeMirror typeMirror, @Nullable Theta map, Java8InferenceContext context) Creates an abstract type for the given TypeMirror.static AbstractTypecreate(AnnotatedTypeMirror type, TypeMirror typeMirror, @Nullable Theta map, AnnotationMirrorMap<QualifierVar> qualifierVars, Java8InferenceContext context, boolean ignoreAnnotations) Creates an abstract type for the given TypeMirror.static AbstractTypecreateIgnoreInstantiated(AnnotatedTypeMirror type, TypeMirror typeMirror, @Nullable Theta map, AnnotationMirrorMap<QualifierVar> qualifierVars, Java8InferenceContext context, boolean ignoreAnnotations) Same ascreate(AnnotatedTypeMirror, TypeMirror, Theta, AnnotationMirrorMap, Java8InferenceContext, boolean), but iftypecontains any type variables that are inmap, but already have an instantiation, they are treated as proper types.booleanReturn the underlying Java type without inference variables.Returns all inference variables mentioned in this type.Return the underlying Java type without inference variables.getKind()Returns the kind ofAbstractType.Returns the primary qualifiers on this type.inthashCode()booleanisObject()Return true if this type is java.lang.Object.isSubType(ProperType superType) Isthisa subtype ofsuperType?toString()Methods inherited from class org.checkerframework.framework.util.typeinference8.types.AbstractType
asSuper, capture, getComponentType, getErased, getFunctionTypeParameterTypes, getFunctionTypeReturnType, getIntersectionBounds, getMostSpecificArrayType, getTypeArguments, getTypeKind, getTypeParameterBounds, getTypeVarLowerBound, getTypeVarUpperBound, getWildcardLowerBound, getWildcardUpperBound, isInferenceType, isLowerBoundedWildcard, isLowerBoundTypeVariable, isParameterizedType, isPrimitiveArray, isProper, isRaw, isUnboundWildcard, isUpperBoundedWildcard, isUseOfVariable, isWildcardParameterizedType, replaceTypeArgs
-
Method Details
-
getKind
Description copied from class:AbstractTypeReturns the kind ofAbstractType.- Specified by:
getKindin classAbstractType- 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 anInferenceTypeiftypecontains any type variables that are mapped to inference variables as specified bymap. Or iftypeis a type variable that is mapped to an inference variable, thatVariableis returned. Or iftypecontains no type variables that are mapped in an inference variable, aProperTypeis returned.- Parameters:
type- the annotated type mirrortypeMirror- the java typemap- a mapping from type variable to inference variablecontext- 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, boolean ignoreAnnotations) Creates an abstract type for the given TypeMirror. The created type is anInferenceTypeiftypecontains any type variables that are mapped to inference variables as specified bymap. Or iftypeis a type variable that is mapped to an inference variable, thatVariableis returned. Or iftypecontains no type variables that are mapped in an inference variable, aProperTypeis returned.- Parameters:
type- the annotated type mirrortypeMirror- the java typemap- a mapping from type variable to inference variablequalifierVars- a mapping from polymorphic annotation toQualifierVarcontext- the contextignoreAnnotations- whether the annotations on this type should be ignored- 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, boolean ignoreAnnotations) Same ascreate(AnnotatedTypeMirror, TypeMirror, Theta, AnnotationMirrorMap, Java8InferenceContext, boolean), but iftypecontains any type variables that are inmap, but already have an instantiation, they are treated as proper types.- Parameters:
type- the annotated type mirrortypeMirror- the java typemap- a mapping from type variable to inference variablequalifierVars- a mapping from polymorphic annotation toQualifierVarcontext- the contextignoreAnnotations- whether the annotations on this type should be ignored- 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 anInferenceTypeif it contains any type variables that are mapped to inference variables as specified bymap. Or if the type is a type variable that is mapped to an inference variable, it will return thatVariable. Or if the type contains no type variables that are mapped in an inference variable, aProperTypeis returned.- Parameters:
types- the annotated type mirrorstypeMirrors- the java typesmap- a mapping from type variable to inference variablequalifierVars- a mapping from polymorphic annotation toQualifierVarcontext- the context- Returns:
- the abstract type for the given TypeMirror and AnnotatedTypeMirror
-
create
public AbstractType create(AnnotatedTypeMirror type, TypeMirror typeMirror, boolean ignoreAnnotations) Description copied from class:AbstractTypeCreates a type using the given types.- Specified by:
createin classAbstractType- Parameters:
type- annotated type mirrortypeMirror- type mirrorignoreAnnotations- whether the annotations on this type should be ignored- Returns:
- the new type
-
equals
- Overrides:
equalsin classAbstractType
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractType
-
getJavaType
Description copied from class:AbstractTypeReturn the underlying Java type without inference variables.- Specified by:
getJavaTypein classAbstractType- Returns:
- the underlying Java type without inference variables
-
getAnnotatedType
Description copied from class:AbstractTypeReturn the underlying Java type without inference variables.- Specified by:
getAnnotatedTypein classAbstractType- Returns:
- the underlying Java type without inference variables
-
isObject
public boolean isObject()Description copied from class:AbstractTypeReturn true if this type is java.lang.Object.- Specified by:
isObjectin classAbstractType- Returns:
- true if this type is java.lang.Object
-
getInferenceVariables
Returns all inference variables mentioned in this type.- Specified by:
getInferenceVariablesin classAbstractType- Returns:
- all inference variables mentioned in this type
-
applyInstantiations
Description copied from class:AbstractTypeReturn a new type that is the same as this one except the variables ininstantiationshave been replaced by their instantiation.- Specified by:
applyInstantiationsin classAbstractType- Returns:
- a new type that is the same as this one except the variables in
instantiationshave been replaced by their instantiation
-
toString
-
getQualifiers
Description copied from class:AbstractTypeReturns the primary qualifiers on this type.- Specified by:
getQualifiersin classAbstractType- Returns:
- the primary qualifiers on this type
-
isSubType
Isthisa subtype ofsuperType?- Parameters:
superType- the potential supertype; is a declared type with no parameters- Returns:
- if
thisis a subtype ofsuperType, then returnConstraintSet.TRUE; otherwise, a false bound is returned
-