code: public static Builder overriding(
        ExecutableElement method, DeclaredType enclosing, Types types) {
      ExecutableType executableType = (ExecutableType) types.asMemberOf(enclosing, method);
      List<? extends TypeMirror> resolvedParameterTypes = executableType.getParameterTypes();
      List<? extends TypeMirror> resolvedThrownTypes = executableType.getThrownTypes();
      TypeMirror resolvedReturnType = executableType.getReturnType();
  
      Builder builder = overriding(method);
      builder.returns(TypeName.get(resolvedReturnType));
      for (int i = 0, size = builder.parameters.size(); i < size; i++) {
        ParameterSpec parameter = builder.parameters.get(i);
        TypeName type = TypeName.get(resolvedParameterTypes.get(i));
        builder.parameters.set(i, parameter.toBuilder(type, parameter.name).build());
      }
      builder.exceptions.clear();
      for (int i = 0, size = resolvedThrownTypes.size(); i < size; i++) {
        builder.addException(TypeName.get(resolvedThrownTypes.get(i)));
      }
  
      return builder;
    }
docs: Returns a new method spec builder that overrides {@code method} as a member of {@code
  enclosing}. This will resolve type parameters: for example overriding {@link
  Comparable#compareTo} in a type that implements {@code Comparable<Movie>}, the {@code T}
  parameter will be resolved to {@code Movie}.
  
  <p>This will copy its visibility modifiers, type parameters, return type, name, parameters, and
  throws declarations. An {@link Override} annotation will be added.
  
  <p>Note that in JavaPoet 1.2 through 1.7 this method retained annotations from the method and
  parameters of the overridden method. Since JavaPoet 1.8 annotations must be added separately.