Java Deprecation
Java.Net is having conversations about removing stuff from the standard Java libraries because they’re getting too big. The comment below really stuck out at me:
Combine that with a program to remove redundant functionality (by declaring it deprecated so it gets killed 2 releases later) and you have a powerful tool to get people to stop using old stuff like Vector and StringTokenizer.”
Vector and StringTokenizer aren’t “old stuff” - they’re extremely useful classes with a specific purpose. Vector is a guaranteed thread safe implementation of List - something you can’t possibly get other than declaring that you want a Vector. To clarify that, consider the method signature public void doStuff(List items) what are the thread safe requirements on items? There’s no way to know and the default assumption would be that it doesn’t have to be thread-safe. Whereas with: public void doStuff(Vector items) the code may be less flexible now but the compiler now guarantees that you’ll get something that at least claims to be thread safe. It is still possible to extend Vector and perform non-thread safe operations but that would be a bug in the extending class because it failed to live up to the contract of the parent class.
StringTokenizer is a particularly useful class in that it provides the simplest way to break a String down into tokens. You could iterator of the characters yourself or you could use regex to do this but manually iterating is reinventing the wheel and regex are highly inefficient for doing what StringTokenizer does. Furthermore, nothing in StringTokenizer is marked as deprecated in my copy of the Java 1.4 API, nor anything in Vector.
Seriously, just because you don’t find something useful doesn’t mean it’s not useful.

June 23rd, 2004 at 1:21 am
“you have a powerful tool to get people to stop using” … Java altogether I would say!
September 10th, 2004 at 8:25 am
I totally agree with Anton however, if the API’s are getting too big in relation to deprecated classes then maybe instead of showing a warning message stating recompile using -deprecation it should state which class should be used instead deprecated one so as not to confuse beginners and students.
I assumed that if a class is deprecated then someone has written a better implementation therefore, if StringTokenizer and Vector get replaced whats the names of the new classes and what extra benefits do they have? or are you expected to write your classes for those that become deprecated?
M Hennessy