Class UpperBoundAnnotatedTypeFactory.UpperBoundQualifierHierarchy

java.lang.Object
org.checkerframework.framework.type.ElementQualifierHierarchy
org.checkerframework.checker.index.upperbound.UpperBoundAnnotatedTypeFactory.UpperBoundQualifierHierarchy
All Implemented Interfaces:
QualifierHierarchy
Enclosing class:
UpperBoundAnnotatedTypeFactory

protected final class UpperBoundAnnotatedTypeFactory.UpperBoundQualifierHierarchy extends ElementQualifierHierarchy
The qualifier hierarchy for the upperbound type system.
  • Method Details

    • greatestLowerBound

      public AnnotationMirror greatestLowerBound(AnnotationMirror a1, AnnotationMirror a2)
      Description copied from interface: QualifierHierarchy
      Returns the greatest lower bound for the qualifiers qualifier1 and qualifier2. Returns null if the qualifiers are not from the same qualifier hierarchy.
      Parameters:
      a1 - first qualifier
      a2 - second qualifier
      Returns:
      greatest lower bound of the two annotations or null if the two annotations are not from the same hierarchy
    • leastUpperBound

      public AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2)
      Determines the least upper bound of a1 and a2. If a1 and a2 are both the same type of Value annotation, then the LUB is the result of taking the intersection of values from both a1 and a2.
      Parameters:
      a1 - the first qualifier; may not be in the same hierarchy as qualifier2
      a2 - the second qualifier; may not be in the same hierarchy as qualifier1
      Returns:
      the least upper bound of a1 and a2
    • widenedUpperBound

      public AnnotationMirror widenedUpperBound(AnnotationMirror newQualifier, AnnotationMirror previousQualifier)
      Description copied from interface: QualifierHierarchy
      If the qualifier hierarchy has an infinite ascending chain, then the dataflow analysis might never reach a fixed point. To prevent this, implement this method such that it returns an upper bound for the two qualifiers that is a strict super type of the least upper bound. If this method is implemented, also override QualifierHierarchy.numberOfIterationsBeforeWidening() to return a positive number.

      newQualifier is newest qualifier dataflow computed for some expression and previousQualifier is the qualifier dataflow computed on the last iteration.

      If the qualifier hierarchy has no infinite ascending chain, returns the least upper bound of the two annotations.

      Parameters:
      newQualifier - new qualifier dataflow computed for some expression; must be in the same hierarchy as previousQualifier
      previousQualifier - the previous qualifier dataflow computed on the last iteration; must be in the same hierarchy as previousQualifier
      Returns:
      an upper bound that is higher than the least upper bound of newQualifier and previousQualifier (or the lub if the qualifier hierarchy does not require this)
    • numberOfIterationsBeforeWidening

      public int numberOfIterationsBeforeWidening()
      Description copied from interface: QualifierHierarchy
      Returns the number of iterations dataflow should perform before QualifierHierarchy.widenedUpperBound(AnnotationMirror, AnnotationMirror) is called or -1 if it should never be called.
      Returns:
      the number of iterations dataflow should perform before QualifierHierarchy.widenedUpperBound(AnnotationMirror, AnnotationMirror) is called or -1 if it should never be called.
    • isSubtype

      public boolean isSubtype(AnnotationMirror subAnno, AnnotationMirror superAnno)
      Computes subtyping as per the subtyping in the qualifier hierarchy structure unless both annotations have the same class. In this case, rhs is a subtype of lhs iff rhs contains every element of lhs.
      Parameters:
      subAnno - possible subqualifier of superQualifier
      superAnno - possible superqualifier of subQualifier
      Returns:
      true if rhs is a subtype of lhs, false otherwise