private static List<AnnotatedElement> resolveTargetElements(AnnotatedElement element,
                                                                Set<FindOption> findOptions) {
        if (!findOptions.contains(FindOption.LOOKUP_SUPER_CLASSES)) {
            return ImmutableList.of(element);
        }

        final boolean collectSuperClassFirst = findOptions.contains(FindOption.COLLECT_SUPER_CLASSES_FIRST);

        if (element instanceof Class) {
            final List<Class<?>> classes = collectClasses((Class<?>) element, collectSuperClassFirst);
            return convertToAnnotatedElements(classes);
        }
        if (element instanceof Method && findOptions.contains(FindOption.LOOKUP_SUPER_METHODS)) {
            final Method method = (Method) element;
            final Class<?> clazz = method.getDeclaringClass();
            final List<Method> methods = collectMethods(clazz, method, collectSuperClassFirst);
            return convertToAnnotatedElements(methods);
        }
        if (element instanceof Parameter && findOptions.contains(FindOption.LOOKUP_SUPER_PARAMETERS)) {
            final Parameter parameter = (Parameter) element;
            final Executable executable = parameter.getDeclaringExecutable();
            final Class<?> clazz = executable.getDeclaringClass();
            final List<Parameter> parameters = collectParameters(clazz, executable, parameter,
                                                                 collectSuperClassFirst);
            return convertToAnnotatedElements(parameters);
        }
        return ImmutableList.of(element);
    }
Collects the list of {@link AnnotatedElement}s which are to be used to find annotations.
core/src/main/java/com/linecorp/armeria/internal/server/annotation/AnnotationUtil.java