title: GSON unable to serialize exception with Java 17
body: <p>The following code used to work on Java 11:</p>
  <pre><code>new Gson().toJson(new Exception())
  </code></pre>
  <p>On JDK 17 I get the following error:</p>
  <pre><code>Unable to make field private java.lang.String java.lang.Throwable.detailMessage accessible: module java.base does not &quot;opens java.lang&quot; to unnamed module @147ed70f
  </code></pre>
  <p>From reading <a href="https://github.com/google/gson/issues/1875" rel="nofollow noreferrer">this page</a>, I think I could resolve it with <code>--add-opens java.base/java.lang=ALL-UNNAMED</code>. Is there a better way however? Perhaps with a custom de/serializer?</p>