title: Cannot cast an Object to generic without a warning
body: <p>I've got a class defined like this:</p>
  
  <pre><code>public class SizeCache&lt;T extends Identifiable&gt; implements Observer {}
  </code></pre>
  
  <p>Identifiable is just an interface that defines a couple of methods.</p>
  
  <p>I have a method:</p>
  
  <pre><code>public T put(final T item) {}
  </code></pre>
  
  <p>That adds an item to a list and is usually called directly with an item of type T but can come from an Observer so in my Observer I want to ensure it is of type T.</p>
  
  <p>However, I cannot write this:</p>
  
  <pre><code>public void update(Observable observable, Object data) {
  if (data instanceof T) {}
  }                   
  </code></pre>
  
  <p>As it tells me I need to use its erasure Identifiable.</p>
  
  <p>However, when I cast it to Identifiable </p>
  
  <pre><code>Identifiable dataItem = (Identifiable) data;
  </code></pre>
  
  <p>the call to put(dataItem) fails with the method put(T) is not applicable for the arguments.</p>
  
  <p>and if I cast to the real type T</p>
  
  <pre><code>T dataItem = (T) data;
  </code></pre>
  
  <p>It warns me it's an unchecked cast. How do I fix this?</p>