static ExecutableType getExecutableElementAsMemberOf(
      Types types, ExecutableElement executableElement, TypeElement subTypeElement) {
    checkNotNull(types);
    checkNotNull(executableElement);
    checkNotNull(subTypeElement);
    TypeMirror subTypeMirror = subTypeElement.asType();
    if (!subTypeMirror.getKind().equals(TypeKind.DECLARED)) {
      throw new IllegalStateException(
          "Expected subTypeElement.asType() to return a class/interface type.");
    }
    TypeMirror subExecutableTypeMirror =
        types.asMemberOf(MoreTypes.asDeclared(subTypeMirror), executableElement);
    if (!subExecutableTypeMirror.getKind().equals(TypeKind.EXECUTABLE)) {
      throw new IllegalStateException("Expected subExecutableTypeMirror to be an executable type.");
    }
    return MoreTypes.asExecutable(subExecutableTypeMirror);
  }
Given an executable element in a supertype, returns its ExecutableType when it is viewed as a
member of a subtype.
factory/src/main/java/com/google/auto/factory/processor/Elements2.java