...
Code Block |
---|
List l = new ArrayList<Integer>(); List<String> ls = l; // Produces unchecked warning |
HoweverIt is not enough to rely on unchecked warnings alone, to implement detect violations of this guideline unchecked warnings cannot not be relied upon. According to the Java Language Specification [JLS 05] section 4.12.2.1 "Heap Pollution":
...
Code Block |
---|
if(o instanceof Set) { // Raw type Set<?> m = (Set<?>) o; // Wildcard type // ... } |
Risk Assessment
Mixing generic and non-generic code may produce unexpected results and exceptional conditions.
...