title: How to make GSON fail on unknown properties
body: <p>I need GSON mapper to throw an exception if json contains unknown fields. For example if we have POJO like</p>
  <pre><code>public class MyClass {
      String name;
  }
  </code></pre>
  <p>and json like</p>
  <pre><code>{
      &quot;name&quot;: &quot;John&quot;,
      &quot;age&quot;: 30
  }
  </code></pre>
  <p>I want to get some sort of message that json contains unknown field (age) that can not be deserialized.</p>
  <p>I know there is out-of-box solution in Jackson mapper, but in our project we have been using Gson as a mapper for several years and using Jackson ends up in conflicts and bugs in different parts of project, so it is easier for me to write my own solution than using Jackson.</p>
  <p>In other words, I want to know if there is some equivalent to Jackson's <code>DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES</code> in Gson. Or maybe if it can be done using Gson's DeserializationStrategy other than using reflections</p>