Possible Duplicate:
Java Generics, how to avoid unchecked assignment warning when using class hierarchy?
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?
Method call causing warning
List<T> refObject = cache.getCachedRefObject(cacheKey, List.class);
Method being called
public <T> T getCachedRefObject(String objectKey, Class<T> type) {
return type.cast(refObjectCache.get(objectKey));
}
Warning details
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");
}
Sounds like you have an old version of IntelliJ. This warning really means Java 5.0+ and AFAIK this was changed when IntelliJ supported Java 6 so the warning was there but didn't say "JDK 5.0 only" (it now has support for Java 8)