Class MostlyNoElementQualifierHierarchy

    • Constructor Detail

      • MostlyNoElementQualifierHierarchy

        protected MostlyNoElementQualifierHierarchy​(java.util.Collection<java.lang.Class<? extends java.lang.annotation.Annotation>> qualifierClasses,
                                                    javax.lang.model.util.Elements elements,
                                                    GenericAnnotatedTypeFactory<?,​?,​?,​?> atypeFactory)
        Creates a MostlyNoElementQualifierHierarchy from the given classes.
        Parameters:
        qualifierClasses - classes of annotations that are the qualifiers for this hierarchy
        elements - element utils
        atypeFactory - the associated type factory
    • Method Detail

      • isSubtypeWithElements

        protected abstract boolean isSubtypeWithElements​(javax.lang.model.element.AnnotationMirror subAnno,
                                                         QualifierKind subKind,
                                                         javax.lang.model.element.AnnotationMirror superAnno,
                                                         QualifierKind superKind)
        Returns true if subAnno is a subtype of superAnno. Both subAnno and superAnno are annotations with elements. subKind is a sub qualifier kind of superKind.
        Parameters:
        subAnno - possible subtype annotation; has elements
        subKind - the QualifierKind of subAnno
        superAnno - possible super annotation; has elements
        superKind - the QualifierKind of superAnno
        Returns:
        true if subAnno is a subtype of superAnno
      • leastUpperBoundQualifiers

        public final @Nullable javax.lang.model.element.AnnotationMirror leastUpperBoundQualifiers​(javax.lang.model.element.AnnotationMirror a1,
                                                                                                   javax.lang.model.element.AnnotationMirror a2)
        Description copied from class: QualifierHierarchy
        Returns the least upper bound (LUB) of the qualifiers qualifier1 and qualifier2. Returns null if the qualifiers are not from the same qualifier hierarchy. Ignores Java basetypes.

        Examples:

        • For NonNull, leastUpperBound('Nullable', 'NonNull') ⇒ Nullable
        Specified by:
        leastUpperBoundQualifiers in class QualifierHierarchy
        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 the qualifiers, or null if the qualifiers are from different hierarchies
      • leastUpperBoundWithElements

        protected abstract javax.lang.model.element.AnnotationMirror leastUpperBoundWithElements​(javax.lang.model.element.AnnotationMirror a1,
                                                                                                 QualifierKind qualifierKind1,
                                                                                                 javax.lang.model.element.AnnotationMirror a2,
                                                                                                 QualifierKind qualifierKind2,
                                                                                                 QualifierKind lubKind)
        Returns the least upper bound of a1 and a2 in cases where the lub of qualifierKind1 and qualifierKind2 is a qualifier kind that has elements. If the lub of qualifierKind1 and qualifierKind2 does not have elements, then QualifierHierarchy.leastUpperBoundShallow(AnnotationMirror, TypeMirror, AnnotationMirror, TypeMirror) returns the correct AnnotationMirror without calling this method.
        Parameters:
        a1 - first annotation
        qualifierKind1 - QualifierKind for a1
        a2 - second annotation
        qualifierKind2 - QualifierKind for a2
        lubKind - the kind of the lub of qualifierKind1 and qualifierKind2
        Returns:
        the least upper bound of a1 and a2
      • greatestLowerBoundQualifiers

        public final @Nullable javax.lang.model.element.AnnotationMirror greatestLowerBoundQualifiers​(javax.lang.model.element.AnnotationMirror a1,
                                                                                                      javax.lang.model.element.AnnotationMirror a2)
        Description copied from class: QualifierHierarchy
        Returns the greatest lower bound for the qualifiers qualifier1 and qualifier2. Returns null if the qualifiers are not from the same qualifier hierarchy.
        Specified by:
        greatestLowerBoundQualifiers in class QualifierHierarchy
        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
      • greatestLowerBoundWithElements

        protected abstract javax.lang.model.element.AnnotationMirror greatestLowerBoundWithElements​(javax.lang.model.element.AnnotationMirror a1,
                                                                                                    QualifierKind qualifierKind1,
                                                                                                    javax.lang.model.element.AnnotationMirror a2,
                                                                                                    QualifierKind qualifierKind2,
                                                                                                    QualifierKind glbKind)
        Returns the greatest lower bound of a1 and a2 in cases where the glb of qualifierKind1 and qualifierKind2 is a qualifier kind that has elements. If the glb of qualifierKind1 and qualifierKind2 does not have elements, then QualifierHierarchy.greatestLowerBoundShallow(AnnotationMirror, TypeMirror, AnnotationMirror, TypeMirror) returns the correct AnnotationMirror without calling this method.
        Parameters:
        a1 - first annotation
        qualifierKind1 - QualifierKind for a1
        a2 - second annotation
        qualifierKind2 - QualifierKind for a2
        Returns:
        the greatest lower bound between a1 and a2