private static Type unwrapAsyncType(Type type, Predicate<Class<?>> asyncTypePredicate) {
        if (type instanceof Class) {
            return type;
        }

        if (!(type instanceof ParameterizedType)) {
            return type;
        }

        final ParameterizedType ptype = (ParameterizedType) type;
        final Type[] typeArguments = ptype.getActualTypeArguments();
        if (typeArguments.length == 0) {
            return type;
        }

        final Class<?> clazz = (Class<?>) ptype.getRawType();
        final Type typeArgument = typeArguments[0];

        return asyncTypePredicate.test(clazz) ? typeArgument : type;
    }
Unwraps an enclosing async type, which includes {@link CompletionStage},
{@link Publisher} and {@code scala.concurrent.Future}, and returns its type arguments.
Returns the accepted type itself if the {@link Type} is not enclosed by one of them.
core/src/main/java/com/linecorp/armeria/internal/server/annotation/ClassUtil.java