private static List<Method> overriddenMethods(Class<?> clazz) {
        final Set<Class<?>> allSuperTypes = ReflectionUtils.getAllSuperTypes(clazz, input -> input != clazz);
        final ImmutableList<Method> methods = allSuperTypes.stream()
                                                           .flatMap(sc -> Arrays.stream(sc.getMethods()))
                                                           .distinct()
                                                           .collect(toImmutableList());
        // In general, if parent classes have a build method, did not override the method with that type.
        if (buildMethodExists(methods)) {
            return ImmutableList.of();
        } else {
            return methods.stream()
                          .filter(m -> m.getReturnType() == m.getDeclaringClass())
                          .collect(toImmutableList());
        }
    }
Makes sure most builder overrides all overridden methods with the correct return type.
it/builders/src/test/java/com/linecorp/armeria/OverriddenBuilderMethodsReturnTypeTest.java