title: Is default no-args constructor mandatory for Gson?
body: <p><a href="https://sites.google.com/site/gson/gson-user-guide">Gson user guide</a> states that we should define default no-args constructor for any class to work with Gson properly. Even more, in the <a href="http://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/InstanceCreator.html">javadoc</a> on Gson's <code>InstanceCreator</code> class said that exception will be thrown if we try to deserialize instance of class missing default constructor and we <em>should</em> use <code>InstanceCreator</code> in such cases. However, I've tried to test use Gson with class lacking default constructor and both serialization and deserialization work without any trouble.</p>
  
  <p>Here is the piece of code for deserializaiton. A class without non-args constructor:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class Mushroom {
      private String name;
      private double diameter;
  
      public Mushroom(String name, double diameter) {
          this.name = name;
          this.diameter = diameter;
      }
  
      //equals(), hashCode(), etc.
  }
  </code></pre>
  
  <p>and a test:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Test
  public void deserializeMushroom() {
      assertEquals(
              new Mushroom("Fly agaric", 4.0),
              new Gson().fromJson(
                      "{name:\"Fly agaric\", diameter:4.0}", Mushroom.class));
  }
  </code></pre>
  
  <p>which works fine.</p>
  
  <p>So my question is: <strong>could I actually use Gson without need to have default constructor or there is any circumstances when it will not work?</strong></p>