Class UseOfVariable
java.lang.Object
org.checkerframework.framework.util.typeinference8.types.AbstractType
org.checkerframework.framework.util.typeinference8.types.UseOfVariable
A use of an inference variable. This class keeps track of whether the use of this variable has a
primary annotation.
-
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, functionType, ignoreAnnotations, typeFactory -
Constructor Summary
ConstructorsConstructorDescriptionUseOfVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type, Variable variable, AnnotationMirrorMap<QualifierVar> qualifierVars, Java8InferenceContext context, boolean ignoreAnnotations) Creates a use of a variable. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBound(Constraint parent, VariableBounds.BoundKind kind, AbstractType bound) Adds a bound for this variable, if this use does not have a primary annotation.voidaddQualifierBound(VariableBounds.BoundKind kind, Set<AbstractQualifier> annotations) Adds a qualifier bound for this variable, if this use does not have a primary annotation.Returns a new type that is the same as this one except the variables ininstantiationshave been replaced by their instantiation.capture(Java8InferenceContext context) Returns a new type that is the capture of this type.create(AnnotatedTypeMirror atm, boolean ignoreAnnotations) Creates a type using the given types.booleanReturns the underlying annotated type.Returns new type whose Java type is the erasure of this type.Returns a collection of all inference variables referenced by this type.Returns the underlying Java type without inference variables.getKind()Returns the kind ofAbstractType.Returns the primary qualifiers on this type.Assuming the type is a declared type, this method returns the upper bounds of its type parameters.Returns the variable that this is a use of.inthashCode()booleanisObject()Returns true if this type is java.lang.Object.voidsetHasThrowsBound(boolean hasThrowsBound) Set whether this use has a throws bound.toString()Methods inherited from class org.checkerframework.framework.util.typeinference8.types.AbstractType
asSuper, checkAnnotationSubtype, create, getComponentType, getEnclosingType, getFunctionTypeParameterTypes, getFunctionTypeReturnType, getIntersectionBounds, getMostSpecificArrayType, getTypeArguments, getTypeKind, getTypeVarLowerBound, getTypeVarUpperBound, getWildcardLowerBound, getWildcardUpperBound, inferenceProblemHashCode, isFunctionalInterface, isInferenceType, isLowerBoundedWildcard, isLowerBoundTypeVariable, isParameterizedType, isPrimitiveArray, isProper, isRaw, isUnboundWildcard, isUpperBoundedWildcard, isUseOfVariable, isWildcardParameterizedType, replaceTypeArgs, sameInferenceProblem
-
Constructor Details
-
UseOfVariable
public UseOfVariable(AnnotatedTypeMirror.AnnotatedTypeVariable type, Variable variable, AnnotationMirrorMap<QualifierVar> qualifierVars, Java8InferenceContext context, boolean ignoreAnnotations) Creates a use of a variable.- Parameters:
type- annotated type variable for this usevariable- variable that this is a use ofqualifierVars- a mapping from polymorphic annotation toQualifierVarcontext- the contextignoreAnnotations- true if the annotations on this type should be ignored
-
-
Method Details
-
create
Description copied from class:AbstractTypeCreates a type using the given types.- Specified by:
createin classAbstractType- Parameters:
atm- annotated type mirrorignoreAnnotations- true if the annotations on this type should be ignored- Returns:
- the new type
-
isObject
public boolean isObject()Description copied from class:AbstractTypeReturns true if this type is java.lang.Object.- Specified by:
isObjectin classAbstractType- Returns:
- true if this type is java.lang.Object
-
getTypeParameterBounds
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.)This implementation always returns a list. The return type is
@Nullableonly becausegetTypeParameterBounds()returns null.An inference variable is not a declared type, so it has no type parameters; this implementation returns null.
- Overrides:
getTypeParameterBoundsin classAbstractType- Returns:
- null, because this type is a use of an inference variable
-
capture
Description copied from class:AbstractTypeReturns a new type that is the capture of this type.- Overrides:
capturein classAbstractType- Parameters:
context- the context object- Returns:
- a new type that is the capture of this type
-
getErased
Description copied from class:AbstractTypeReturns new type whose Java type is the erasure of this type.- Overrides:
getErasedin classAbstractType- Returns:
- a new type whose Java type is the erasure of this type
-
getJavaType
Description copied from class:AbstractTypeReturns the underlying Java type without inference variables.- Specified by:
getJavaTypein classAbstractType- Returns:
- the underlying Java type without inference variables
-
getAnnotatedType
Description copied from class:AbstractTypeReturns the underlying annotated type.- Specified by:
getAnnotatedTypein classAbstractType- Returns:
- the underlying annotated type
-
getKind
Description copied from class:AbstractTypeReturns the kind ofAbstractType.- Specified by:
getKindin classAbstractType- Returns:
- the kind of
AbstractType
-
getInferenceVariables
Description copied from class:AbstractTypeReturns a collection of all inference variables referenced by this type.- Specified by:
getInferenceVariablesin classAbstractType- Returns:
- a collection of all inference variables referenced by this type
-
applyInstantiations
Description copied from class:AbstractTypeReturns 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
-
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- true if this use has a throws bound
-
addQualifierBound
Adds a qualifier bound for this variable, if this use does not have a primary annotation.- Parameters:
kind- the kind of boundannotations- the qualifiers to add
-
addBound
Adds a bound for this variable, if this use does not have a primary annotation.- Parameters:
parent- the constraint whose reduction created this boundkind- the kind of boundbound- the type of the bound
-
getQualifiers
Description copied from class:AbstractTypeReturns the primary qualifiers on this type.- Specified by:
getQualifiersin classAbstractType- Returns:
- the primary qualifiers on this type
-
toString
-
equals
- Specified by:
equalsin classAbstractType
-
hashCode
public int hashCode()- Specified by:
hashCodein classAbstractType
-