title: Gson: serializing a java.nio.Path causes a StackOverflowError
body: <p>Serializing this, causes a StackOverFlowError :</p>
  
  <pre><code>import java.nio.file.Path;
  import java.nio.file.Paths;
  
  public class Tmp{
      private Path path=null;
      public Tmp() {
          path=Paths.get("c:\\temp\\");
      }
  }
  </code></pre>
  
  <p>It looks like a bug to me ! Or I'm doing something wrong ?
  Is there workaround (expect writing some custom serializer that converts the path to String)</p>
  
  <pre><code>java.lang.StackOverflowError
      at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:372)
  
      at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:381)
      at com.google.gson.internal.$Gson$Types.resolve($Gson$Types.java:376)
      ...
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:128)
  
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:75)
      at com.google.gson.Gson.getAdapter(Gson.java:358)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getFieldAdapter(ReflectiveTypeAdapterFactory.java:109)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.access$100(ReflectiveTypeAdapterFactory.java:46)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.&lt;init&gt;(ReflectiveTypeAdapterFactory.java:84)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:83)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:129)
      ...
  </code></pre>
  
  <p>Serializing method is:</p>
  
  <pre><code>public static void saveTo(BatchLogging logging, Path path) throws IOException {
      Gson gson=new GsonBuilder().setPrettyPrinting().create();
      // String json = gson.toJson(logging);
      String json = gson.toJson(new Tmp());
      List&lt;String&gt; lines = Arrays.asList(json.split(System.lineSeparator()));
      Files.write(path, lines, StandardCharsets.UTF_8);
  }
  </code></pre>