title: Java generics reference not working
body: <p>Not sure what's going on here, I'm trying to do something really simple, set an object by reference. I wrote the same code twice, once setting the object by reference, once returning the new object and setting it there. Here's the code</p>
  
  <pre><code>for (Person p : test) {
      bcPetDao.refreshRef(p.pet);
      Log.e("Woo1", "Name:" + p.pet);
      Log.e("Woo1", "Addess: " + p.pet.hashCode());
  }
  for (Person p : test) {
      p.pet = bcPetDao.refresh(p.pet);
  }
  Log.e("Woo2", "Name:" + test.get(0).pet);
  </code></pre>
  
  <p>And the code for refresh and refreshRef is:</p>
  
  <pre><code>public T refresh(T object) {
      try {
          String id = cachedClass.idEntry.getKey().get(object).toString();
          return queryOne(new Query(cachedClass.idColName + " = ?", new String[] { id }, null, null, null, null));
      } catch (IllegalArgumentException e) {
          throw new RuntimeException(e);
      } catch (IllegalAccessException e) {
          throw new RuntimeException(e);
      }
  }
  
  public void refreshRef(T object) {
      try {
          String id = cachedClass.idEntry.getKey().get(object).toString();
          object = queryOne(new Query(cachedClass.idColName + " = ?", new String[] { id }, null, null, null, null));
          BcLog.e("In Ref name is: " + object.toString());
          BcLog.e("Addess: " + object.hashCode());
      } catch (IllegalArgumentException e) {
          throw new RuntimeException(e);
      } catch (IllegalAccessException e) {
          throw new RuntimeException(e);
      }
  }
  </code></pre>
  
  <p>Is there something with Java generics that makes this not just work? Here's the log printout.</p>
  
  <pre><code>04-23 22:50:55.643: E/BcLog(30237): In Ref name is: ID: 119, name: 3fdb2a3ab1c0a2e8
  04-23 22:50:55.643: E/BcLog(30237): Addess: 1090746752
  04-23 22:50:55.643: E/Woo1(30237): Name:ID: 119, name: null
  04-23 22:50:55.643: E/Woo1(30237): Addess: 1087524160
  04-23 22:50:55.663: E/BcLog(30237): In Ref name is: ID: 118, name: 3fccb118500e0f1c
  04-23 22:50:55.663: E/BcLog(30237): Addess: 1088206960
  04-23 22:50:55.663: E/Woo1(30237): Name:ID: 118, name: null
  04-23 22:50:55.663: E/Woo1(30237): Addess: 1087682616
  04-23 22:50:55.684: E/BcLog(30237): In Ref name is: ID: 117, name: 3fe026bb4d24bfe2
  04-23 22:50:55.684: E/BcLog(30237): Addess: 1088359352
  04-23 22:50:55.684: E/Woo1(30237): Name:ID: 117, name: null
  04-23 22:50:55.684: E/Woo1(30237): Addess: 1090724368
  04-23 22:50:55.714: E/BcLog(30237): In Ref name is: ID: 116, name: 3fe26d6a3967d838
  04-23 22:50:55.714: E/BcLog(30237): Addess: 1090659992
  04-23 22:50:55.714: E/Woo1(30237): Name:ID: 116, name: null
  04-23 22:50:55.714: E/Woo1(30237): Addess: 1088417312
  04-23 22:50:55.734: E/BcLog(30237): In Ref name is: ID: 115, name: 3fef8ec496c0cdb2
  04-23 22:50:55.734: E/BcLog(30237): Addess: 1088221128
  04-23 22:50:55.744: E/Woo1(30237): Name:ID: 115, name: null
  04-23 22:50:55.744: E/Woo1(30237): Addess: 1088572064
  04-23 22:50:55.824: E/Woo2(30237): Name:ID: 119, name: 3fdb2a3ab1c0a2e8
  </code></pre>