...
The use of raw types is allowed only as a concession to compatibility of legacy code. The use of raw types in code written after the introduction of genericity into the Java programming language is strongly discouraged. It is possible that future versions of the Java programming language will disallow the use of raw types.
Noncompliant Code Example
This noncompliant code example compiles but results in heap pollution. The compiler produces an unchecked warning because a raw argument (the obj parameter in the addToList() method) is passed to the List.add() method.
...
Even when heap pollution occurs, the variable is still guaranteed to refer to a subclass or subinterface of the declared type, but is not guaranteed to always refer to a subtype of its declared type. In this example, list does not refer to a subtype of its declared type (List<String>), but only to the subinterface of the declared type (List).
Compliant Solution (Parameterized Collection)
This compliant solution enforces type safety by changing the addToList() method signature to enforce proper type checking.
...