private static boolean getMetaAnnotations(ImmutableList.Builder<Annotation> builder, Annotation annotation,
                                              Predicate<Annotation> collectingFilter,
                                              Set<Class<? extends Annotation>> visitedAnnotationTypes) {

        final Class<? extends Annotation> annotationType = annotation.annotationType();

        if (knownCyclicAnnotationTypes.contains(annotationType)) {
            return false;
        }
        if (!visitedAnnotationTypes.add(annotationType)) {
            disallowedListAnnotation(annotationType);
            return false;
        }

        final Annotation[] metaAnnotations = annotationType.getDeclaredAnnotations();
        for (final Annotation metaAnnotation : metaAnnotations) {

            if (getMetaAnnotations(builder, metaAnnotation, collectingFilter,
                                   visitedAnnotationTypes) &&
                collectingFilter.test(metaAnnotation)) {
                builder.add(metaAnnotation);
            }
        }

        visitedAnnotationTypes.remove(annotationType);
        return true;
    }
Returns all annotations searching from the specified {@code element}. The search range depends on
the specified {@link FindOption}s and the specified {@code collectingFilter} decides whether
an annotation is collected or not.

@param element the {@link AnnotatedElement} to find annotations
@param findOptions the options to be applied when retrieving annotations
@param collectingFilter the predicate which decides whether the annotation is to be collected or not
core/src/main/java/com/linecorp/armeria/internal/server/annotation/AnnotationUtil.java