code: private static void formatArgTo(List<Dependency> path, StringBuilder builder) {
      if (path.isEmpty()) {
        return;
      }
  
      builder.append("\n");
      boolean first = true;
      Key<?> previousTarget = null; // For sanity-checking.
      for (Dependency dependency : path) {
        Key<?> source = dependency.getSource();
        Key<?> target = dependency.getTarget();
  
        // Sanity-check.
        if (previousTarget != null && !previousTarget.equals(source)) {
          throw new IllegalArgumentException("Dependency list is not a path.");
        }
  
        // There are two possible overall shapes of the list:
        //
        // If it starts with GINJECTOR, we get this:
        //
        // Key1 [context]
        //  -> Key2 [context]
        //  ...
        //
        // Otherwise (e.g., if we're dumping a cycle), we get this:
        //
        // Key1
        //  -> Key2 [context]
        //  -> Key3 [context]
        //  ...
        if (first) {
          if (source == Dependency.GINJECTOR) {
            formatArgTo(target, builder);
            builder.append(String.format(" [%s]%n", dependency.getContext()));
          } else {
            formatArgTo(source, builder);
            builder.append("\n -> ");
            formatArgTo(target, builder);
            builder.append(String.format(" [%s]%n", dependency.getContext()));
          }
  
          first = false;
        } else {
          builder.append(" -> ");
          formatArgTo(target, builder);
          builder.append(String.format(" [%s]%n", dependency.getContext()));
        }
  
        previousTarget = target;
      }
    }
docs: Formats a list of dependencies as a dependency path; see the class
  comments.