EVALUATION
This is a "raw type" which is part of the language to preserve backwards compatibility. It is not unsafe to instantiate a raw type, but to convert it to a parameterized type. That is what the warning says.
###@###.### 2004-08-30
Some quotes from JLS (??4.8):
"To facilitate interfacing with non-generic legacy code, it is also possible to use as a type the erasure (??4.6) of a parameterized type (??4.5).
...
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.
...
The superclasses (respectively, superinterfaces) of a raw type are the erasures of the superclasses (superinterfaces) of any of its parameterized instances."
In particular this means that the direct supertype of the raw type Bar.B is the raw type Vector, not Vector<String>.
Also, don't ever use raw types. Raw types are in the language to facilitate backwards compatibility. The mechanism is surprisingly complex and we would end up breaking some old programs if the specification were changed to not include the super type. If you ever want to solve a problem by mixing raw with generics: don't. It should always be possible to use unbounded wildcards <?> instead. Otherwise, file a bug and let us know.
###@###.### 2004-09-01
|