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, typeFactory
-
Constructor Summary
ConstructorDescriptionUseOfVariable
(AnnotatedTypeMirror.AnnotatedTypeVariable type, Variable variable, AnnotationMirrorMap<QualifierVar> qualifierVars, Java8InferenceContext context) Creates a use of a variable. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBound
(VariableBounds.BoundKind kind, AbstractType bound) Adds a bound for this variable, is this use does not have a primary annotation.void
addQualifierBound
(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 ininstantiations
have been replaced by their instantiation.capture
(Java8InferenceContext context) Return a new type that is the capture of this type.create
(AnnotatedTypeMirror atm, TypeMirror type) Creates a type using the given types.boolean
Return 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.int
hashCode()
boolean
isObject()
Return true if this type is java.lang.Object.void
setHasThrowsBound
(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) 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 toQualifierVar
context
- the context
-
-
Method Details
-
create
Description copied from class:AbstractType
Creates a type using the given types.- Specified by:
create
in classAbstractType
- Parameters:
atm
- annotated type mirrortype
- 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 classAbstractType
- Returns:
- true if this type is java.lang.Object
-
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 classAbstractType
- Returns:
- the upper bounds of the type parameter of this type
-
capture
Description copied from class:AbstractType
Return a new type that is the capture of this type.- Overrides:
capture
in classAbstractType
- Parameters:
context
- the context object- Returns:
- a new type that is the capture of this type
-
getErased
Description copied from class:AbstractType
Return new type whose Java type is the erasure of this type.- Overrides:
getErased
in classAbstractType
- Returns:
- a new type whose Java type is the erasure of this type
-
getJavaType
Description copied from class:AbstractType
Return the underlying Java type without inference variables.- Specified by:
getJavaType
in classAbstractType
- Returns:
- the underlying Java type without inference variables
-
getAnnotatedType
Description copied from class:AbstractType
Return the underlying Java type without inference variables.- Specified by:
getAnnotatedType
in classAbstractType
- Returns:
- the underlying Java type without inference variables
-
getKind
Description copied from class:AbstractType
Returns the kind ofAbstractType
.- Specified by:
getKind
in classAbstractType
- Returns:
- the kind of
AbstractType
-
getInferenceVariables
Description copied from class:AbstractType
Return a collection of all inference variables referenced by this type.- Specified by:
getInferenceVariables
in classAbstractType
- Returns:
- a collection of all inference variables referenced by this type
-
applyInstantiations
Description copied from class:AbstractType
Return a new type that is the same as this one except the variables ininstantiations
have been replaced by their instantiation.- Specified by:
applyInstantiations
in classAbstractType
- Returns:
- a new type that is the same as this one except the variables in
instantiations
have 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:
kind
- the kind of boundbound
- the type of the bound
-
getQualifiers
Description copied from class:AbstractType
Returns the primary qualifiers on this type.- Specified by:
getQualifiers
in classAbstractType
- Returns:
- the primary qualifiers on this type
-
toString
-
equals
- Overrides:
equals
in classAbstractType
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractType
-