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, 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, is this use does not have a primary annotation.voidaddQualifierBound(VariableBounds.BoundKind kind, Set<AbstractQualifier> annotations) Adds a qualifier bound for this variable, is this use does not have a primary annotation.Return a new type that is the same as this one except the variables ininstantiationshave been replaced by their instantiation.capture(Java8InferenceContext context) Return a new type that is the capture of this type.create(AnnotatedTypeMirror atm, TypeMirror type, boolean ignoreAnnotations) Creates a type using the given types.booleanReturn the underlying Java type without inference variables.Return new type whose Java type is the erasure of this type.Return a collection of all inference variables referenced by this type.Return 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()Return 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, getComponentType, getFunctionTypeParameterTypes, getFunctionTypeReturnType, getIntersectionBounds, getMostSpecificArrayType, getTypeArguments, getTypeKind, getTypeVarLowerBound, getTypeVarUpperBound, getWildcardLowerBound, getWildcardUpperBound, isInferenceType, isLowerBoundedWildcard, isLowerBoundTypeVariable, isParameterizedType, isPrimitiveArray, isProper, isRaw, isUnboundWildcard, isUpperBoundedWildcard, isUseOfVariable, isWildcardParameterizedType, replaceTypeArgs
-
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- whether 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 mirrortype- type mirrorignoreAnnotations- whether the annotations on this type should be ignored- Returns:
- the new type
-
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
-
getTypeParameterBounds
Description copied from class:AbstractTypeAssuming 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:
getTypeParameterBoundsin classAbstractType- Returns:
- the upper bounds of the type parameter of this type
-
capture
Description copied from class:AbstractTypeReturn 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:AbstractTypeReturn 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: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
-
getKind
Description copied from class:AbstractTypeReturns the kind ofAbstractType.- Specified by:
getKindin classAbstractType- Returns:
- the kind of
AbstractType
-
getInferenceVariables
Description copied from class:AbstractTypeReturn 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: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
-
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
Adds a qualifier bound for this variable, is 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, is 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
- Overrides:
equalsin classAbstractType
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractType
-