Class BoundsInitializer

java.lang.Object
org.checkerframework.framework.type.BoundsInitializer

public class BoundsInitializer extends Object
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 Details

    • initializeBounds

      public static void initializeBounds(AnnotatedTypeMirror.AnnotatedTypeVariable typeVar)
      Creates and sets the upper and lower bounds of typeVar that match the upper and lower bounds of the underlying type of typeVar.
      Parameters:
      typeVar - an AnnotatedTypeMirror.AnnotatedTypeVariable
    • initializeBounds

      public static void initializeBounds(AnnotatedTypeMirror.AnnotatedWildcardType wildcard)
      Creates and sets the extends and super bounds of wildcard that match the extends and super bounds of the underlying type of wildcard.
      Parameters:
      wildcard - an AnnotatedTypeMirror.AnnotatedWildcardType
    • getUpperBoundAsWildcard

      public static WildcardType getUpperBoundAsWildcard(TypeVariable typeVariable, Types types)
      Returns a wildcard whose extends bound is the same as typeVariable's upper bound. If the upper bound is an intersection, then this method returns an unbound wildcard.
      Parameters:
      typeVariable - a type variable
      types - types util
      Returns:
      a wildcard whose extends bound is the same as the upper bound of typeVariable