What is happening is when use use a class (or interface) with a generic parameter
but refer to and instance of the without
(ie. that raw
type) the compiler erases all generic type information from the class. This is likely due to compatibility with pre-1.5 source code where you wouldn't be able to use generic type information at all.
Consider the situation where you are writing code and compiling on a Java 1.4 compiler. You want to use a library which makes use of generics. When you refer to a type from that library which has generic parameters as a raw type, the compiler enforces the use of no generic parameters.
EDIT:
The JLS-4.8-210 alludes to this when it mentions (credit: zhong-j-yu):
The type of a constructor (§8.8), instance method (§8.4, §9.4), or non-static field (§8.3) M of a raw type C that is not inherited from its superclasses or superinterfaces is the raw type that corresponds to the erasure of its type in the generic declaration corresponding to C.
This still feels like a gotcha, but it is likely for some reason.