Should a future release of Java deprecate the use of raw types to force the migration to generics? I could also see having raw types not allowed by default but allowing them via a compile flag for legacy code.
Raw types are pretty much deprecated already. It is a compiler warning to use a ray type.
The behavior is just like a depreciated method. People just need to learn not to use the raw types.
And break all of my old (pre-Java 5) code? I've tested that code already, and I assure you it is type-safe. No thanks.
In Eclipse, you can instruct the compiler on how to handle raw types. By default, they are a Warning. But they can easily be set to Error. To change the settings:
Window > Preferences > Java > Compiler > Errors/Warnings > Generic Types
If you're working on an entirely new code base, you probably want to set that to Error in your project specific settings. Then check in your project files into your SCM so everyone gets the same project rules.
It should be noted that you can't deprecate the raw types; the generic types ARE the raw types. The compiler erases the type information when it creates the class files.
You can use compiler warnings or errors to enforce local coding policy. However there will be cases where you need to use raw types, such as if you are interfacing with an old library.