private static void getAllMethods(
      TypeElement type, SetMultimap<String, ExecutableElement> methods) {
    for (TypeMirror superInterface : type.getInterfaces()) {
      getAllMethods(MoreTypes.asTypeElement(superInterface), methods);
    }
    if (type.getSuperclass().getKind() != TypeKind.NONE) {
      // Visit the superclass after superinterfaces so we will always see the implementation of a
      // method after any interfaces that declared it.
      getAllMethods(MoreTypes.asTypeElement(type.getSuperclass()), methods);
    }
    for (ExecutableElement method : ElementFilter.methodsIn(type.getEnclosedElements())) {
      methods.put(method.getSimpleName().toString(), method);
    }
  }
Returns the set of all methods from {@code type}, including methods that it inherits from its
ancestors. Inherited methods that are overridden are not included in the result. So if {@code
type} defines {@code public String toString()}, the returned set will contain that method, but
not the {@code toString()} method defined by {@code Object}.

<p>The returned set may contain more than one method with the same signature, if {@code type}
inherits those methods from different ancestors. For example, if it inherits from unrelated
interfaces {@code One} and {@code Two} which each define {@code void foo();}, and if it does
not itself override the {@code foo()} method, then both {@code One.foo()} and {@code Two.foo()}
will be in the returned set.

<p>The order of the returned set is deterministic: within a class or interface, methods are in
the order they appear in the source code; methods in ancestors come before methods in
descendants; methods in interfaces come before methods in classes; and in a class or interface
that has more than one superinterface, the interfaces are in the order of their appearance in
{@code implements} or {@code extends}.

@param type the type whose own and inherited methods are to be returned
@param typeUtils a {@link Types} object, typically returned by {@link
    javax.annotation.processing.AbstractProcessor#processingEnv processingEnv}.{@link
    javax.annotation.processing.ProcessingEnvironment#getTypeUtils getTypeUtils()}
@param elementUtils an {@link Elements} object, typically returned by {@link
    javax.annotation.processing.AbstractProcessor#processingEnv processingEnv}.{@link
    javax.annotation.processing.ProcessingEnvironment#getElementUtils getElementUtils()}
common/src/main/java/com/google/auto/common/MoreElements.java