private static void getLocalAndInheritedMethods(
            PackageElement pkg, TypeElement type, SetMultimap<String, ExecutableElement> methods) {

        for (TypeMirror superInterface : type.getInterfaces()) {
            getLocalAndInheritedMethods(pkg, 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.
            getLocalAndInheritedMethods(pkg, MoreTypes.asTypeElement(type.getSuperclass()), methods);
        }
        for (ExecutableElement method : ElementFilter.methodsIn(type.getEnclosedElements())) {
            if (!method.getModifiers().contains(Modifier.STATIC)
                    && methodVisibleFromPackage(method, pkg)) {
                methods.put(method.getSimpleName().toString(), method);
            }
        }
    }
Static utility methods pertaining to {@link Element} instances.

@author Gregory Kick
android/annotation_processors/permission-requester-compiler/src/main/java/github/tornaco/permission/compiler/common/MoreElements.java