title: Intellij Warning - Generic Unchecked Assignment
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5309922/java-generics-how-to-avoid-unchecked-assignment-warning-when-using-class-hierar">Java Generics, how to avoid unchecked assignment warning when using class hierarchy?</a>  </p>
  </blockquote>
  
  
  
  <p>Intellij is giving me the warning below.  Not sure how to resolve it, or even if I need to resolve it.  The warning details says it only applies to JDK 5, and I am using 6.  I am wondering if I need to respond to this, and if so, how?</p>
  
  <p>Method call causing warning</p>
  
  <pre><code>List&lt;T&gt; refObject = cache.getCachedRefObject(cacheKey, List.class);
  </code></pre>
  
  <p>Method being called</p>
  
  <pre><code>public  &lt;T&gt; T getCachedRefObject(String objectKey, Class&lt;T&gt; type) {
      return type.cast(refObjectCache.get(objectKey));
  }
  </code></pre>
  
  <p>Warning details</p>
  
  <pre><code>Unchecked Assignment
  JDK 5.0 only. Signals places where an unchecked warning is issued by the compiler, for example:
      void f(HashMap map) {
          map.put("key", "value");
      }
  </code></pre>