title: Gson error "declares multiple JSON fields named" for overridden inherited fields
body: <p>I have 2 classes:</p>
  
  <p><strong>Parent</strong>  </p>
  
  <pre><code>class Parent {
      @SerializedName("variable1")
      int variable1;
  
      @SerializedName("child")
      Child child;
  
      //Getters and Setters
  }
  </code></pre>
  
  <p><strong>Child</strong></p>
  
  <pre><code>class Child {
      @SerializedName("childVar")
      int childVar1;
  
      //Getters and Setters
  }
  </code></pre>
  
  <p>Those are extended like:</p>
  
  <p><strong>ExtendedChild</strong></p>
  
  <pre><code>class ExtendedChild extends Child {
      @SerializedName("childVar2")
      int childVar2;
  
      //Getters and Setters
  }
  </code></pre>
  
  <p><strong>ExtendedParent</strong></p>
  
  <pre><code>class ExtendedParent extends Parent {
      @SerializedName("variable2")
      int variable2; 
  
      @SerializedName("child")
      ExtendedChild extendedChild;
  
      //Getters and Setters
  }
  </code></pre>
  
  <p>I want to use these classes for un marshaling from Json. I am planning to use GSON library. I want to un marshal either to ExtendedParent or Parent classes based on the payload. I know in my code which type of Parent it is. Just to represent properly and to avoid redundant variable declaration, I wanted to go with Inheritance. Below are two examples I have with me- </p>
  
  <p>I will marshal the below payload to ExtendedParent.class</p>
  
  <pre><code>{
      'variable1':12,
      'variable2':23,
      'child':{
          'childVar1': 43,
          'childVar2': 23
      }
  }
  </code></pre>
  
  <p>I will marshal the below payload to Parent.class</p>
  
  <pre><code>{
      'variable1':12,
      'child':{
          'childVar1': 43
      }
  }
  </code></pre>
  
  <p>However, when I try to to un marshal as below-, </p>
  
  <pre><code>ExtendedParent extendedParent = new Gson()
          .fromJson('&lt;Passing the first Json string above&gt;', ExtendedParent.class);
  </code></pre>
  
  <p>I face below exception. </p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: class ExtendedParent declares
    multiple JSON fields named child</p>
  </blockquote>
  
  <p>Not able to figure out what is the issue. Any help or pointers will be highly appreciated. I tried several ways to avoid variable hiding on the Child objects but I am not able to figure it out on how to solve this problem. </p>