title: Gson & Java - Attempted to serialize java.lang.Class: ..... Forgot to register a type adapter?
body: <p>I'm trying to create an abstract class for defining configuration classes. I wish to export and import these classes from and to JSON whenever I want to. I'm trying to achieve this using Gson.</p>
  
  <p>I'm getting an error when writing to JSON that states it:</p>
  
  <blockquote>
    <p>can't serialize java.lang.Class - Forgot to register a type adapter?</p>
  </blockquote>
  
  <p>My main class: <a href="https://hastebin.com/pogohodovi.scala" rel="noreferrer">https://hastebin.com/pogohodovi.scala</a><br>
  Abstract config class: <a href="https://hastebin.com/adeyawubuy.cs" rel="noreferrer">https://hastebin.com/adeyawubuy.cs</a></p>
  
  <p>An example of a child class:</p>
  
  <pre><code>public class DyescapeCOREConfiguration extends DyescapeConfiguration {
  
      private static transient DyescapeCOREConfiguration i = new DyescapeCOREConfiguration();
      public static DyescapeCOREConfiguration get() { return i; }
  
      @Expose public static String ServerID = UUID.randomUUID().toString();
  
  }
  </code></pre>
  
  <p>Please note: I need to keep the variables in the child configuration classes static. I tried to create some adapters/serializers, but they don't seem to work.</p>