Class AnnotationOverlayImpl

    • Field Detail

      • compatibleMode

        final boolean compatibleMode
      • runtimeAnnotationsOnly

        final boolean runtimeAnnotationsOnly
      • inheritedAnnotations

        final boolean inheritedAnnotations
    • Constructor Detail

      • AnnotationOverlayImpl

        AnnotationOverlayImpl​(IndexView index,
                              boolean compatibleMode,
                              boolean runtimeAnnotationsOnly,
                              boolean inheritedAnnotations,
                              java.util.Collection<AnnotationTransformation> annotationTransformations)
    • Method Detail

      • index

        public final IndexView index()
        Description copied from interface: AnnotationOverlay
        Returns the index whose annotation information is being overlaid.
        Specified by:
        index in interface AnnotationOverlay
        Returns:
        the index underlying this annotation overlay, never null
      • hasAnyAnnotation

        public final boolean hasAnyAnnotation​(Declaration declaration,
                                              java.util.Set<DotName> names)
        Description copied from interface: AnnotationOverlay
        Returns whether any annotation instance with one of given names is declared on given declaration.

        This method ignores annotations declared on nested annotation targets. This doesn't hold in case of methods in the compatible mode, where method parameters are considered part of methods.

        Specified by:
        hasAnyAnnotation in interface AnnotationOverlay
        Parameters:
        declaration - the declaration to inspect, must not be null
        names - names of the annotation types to look for, must not be null
        Returns:
        true if any of the annotations is present, false otherwise
      • annotation

        public final AnnotationInstance annotation​(Declaration declaration,
                                                   DotName name)
        Description copied from interface: AnnotationOverlay
        Returns the annotation instance with given name declared on given declaration.

        Like AnnotationTarget.declaredAnnotation(DotName), and unlike AnnotationTarget.annotation(DotName), this method doesn't return annotations declared on nested annotation targets. This doesn't hold in case of methods in the compatible mode, where method parameters are considered part of methods. In such case, if more than one annotation of given name is present, an unspecified instance is returned.

        Specified by:
        annotation in interface AnnotationOverlay
        Parameters:
        declaration - the declaration to inspect, must not be null
        name - name of the annotation type to look for, must not be null
        Returns:
        the annotation instance, or null if not found