title: How to change a private field in a parent class
body: <p>I have using the Vaadin framework and want to override some behavior.  </p>
  
  <p>Problem is that all setters for a field have side effects that I don't want to invoke.</p>
  
  <p>For this reason I want to set the private field directly.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>@Override
  public void setItemDataSource(Item itemDataSource) {
      //do some stuff
      java.lang.reflect.Field privateField = this.getClass().getDeclaredField(itemDatasource); //Yes the spelling is correct.
      privateField.set(this, itemDataSource);   &lt;&lt;-- I get an error.
      //do more stuff
  </code></pre>
  
  <p>I get the following error.</p>
  
  <blockquote>
    <p>//TODO: copy paste error.</p>
  </blockquote>
  
  <p>Apparently I'm not supposed to include <code>this</code> as the object who's field need to be changed, but some other reference.<br>
  What am I doing wrong?</p>