Class BoundsInitializer
java.lang.Object
org.checkerframework.framework.type.BoundsInitializer
BoundsInitializer
creates AnnotatedTypeMirrors (without annotations) for the bounds of
type variables and wildcards. It ensures that recursive type variables refer to themselves at the
correct location. Other kinds of composite types are lazily initialized in
AnnotatedTypeMirror
.
Its static helper methods are called from AnnotatedTypeMirror. When an initializer method is called for a particular bound, the entirety of that bound, including circular references, is created.
-
Method Summary
Modifier and TypeMethodDescriptionstatic WildcardType
getUpperBoundAsWildcard
(TypeVariable typeVariable, Types types) Returns a wildcard whose extends bound is the same astypeVariable
's upper bound.static void
Creates and sets the upper and lower bounds oftypeVar
that match the upper and lower bounds of the underlying type oftypeVar
.static void
Creates and sets the extends and super bounds ofwildcard
that match the extends and super bounds of the underlying type ofwildcard
.
-
Method Details
-
initializeBounds
Creates and sets the upper and lower bounds oftypeVar
that match the upper and lower bounds of the underlying type oftypeVar
.- Parameters:
typeVar
- anAnnotatedTypeMirror.AnnotatedTypeVariable
-
initializeBounds
Creates and sets the extends and super bounds ofwildcard
that match the extends and super bounds of the underlying type ofwildcard
.- Parameters:
wildcard
- anAnnotatedTypeMirror.AnnotatedWildcardType
-
getUpperBoundAsWildcard
Returns a wildcard whose extends bound is the same astypeVariable
's upper bound. If the upper bound is an intersection, then this method returns an unbound wildcard.- Parameters:
typeVariable
- a type variabletypes
- types util- Returns:
- a wildcard whose extends bound is the same as the upper bound of
typeVariable
-