Fog Creek Software
Discussion Board

Deprecated Java Platform Classes

Okay, I'm a newbie to Java and I'm working through the libraries.  So when I want to do something, I search through the java docs to find what I need.  The trouble is that, in a good number of cases, all the stuff I find is deprecated!  (BTW, is there anything that's not deprecated?!?)  My question is, is there a way to find out what's replacing the deprecated classes & methods?

balogna bill
Wednesday, June 9, 2004

The latest version of the JavaDocs will tell you what you should use instead.

IntelliJ will warn you and suggest a replacement when you try to use a deprecated method. Other IDEs may do the same.

Wednesday, June 9, 2004

The javadoc is usually very clear on what replaces the deprecated code.

Specifically, what classes/methods do you want to use that are deprecated?

Wednesday, June 9, 2004

No.  All the Java classes are deprecated.

name withheld out of cowardice
Wednesday, June 9, 2004

Can you give an example of what's deprecated?  In my day to day use, I find very little is.

Wednesday, June 9, 2004

I agree.  I used Java full-time for about 3 years, and this is a major annoyance.  You run into deprecated classes and methods regularly and usually they don't say what to use instead.  Sometimes they deprecate and even remove it without adding any replacement, so you're SOL.  (Write your own, from scratch...)

The best I can offer is: ask coworkers, search mailing lists, and google.

Wednesday, June 9, 2004

For instance, some Thread methods are deprecated. In those cases, there's some good documentation as to why they were deprecated, so try to read that.

Thursday, June 10, 2004

The last thing was acouple of weeks ago...  I found some code on the web that had some method tp simply call and have it serialize a resultSet to XML.  It's gone now, and I can't figure out what to use in its place.  (I'm sorry, I don't remember the exact names of the classes & methods.)

balogna bill
Thursday, June 10, 2004

> No.  All the Java classes are deprecated.

Sorry bill, you came to the wrong forum.

This a Microsoft groupie meeting place, most joelsters only get hardons from VS.NET and related suff.

The Masked Programmer
Thursday, June 10, 2004

Hmm, "deprecation" seems different from a disappearing lib which you found on the net. Deprecation is only a label that the powers-that-be would like to get rid of something.

Since (by certain metrics) Java tends to have the best api docs in the world, I'm surprised this is a problem. While many companies go nuts when deprecation happens, I think it's great; part of a living language. Especially since implementors take a really long time getting rid of deprecated things.

Tayssir John Gabbour
Thursday, June 10, 2004

There are many deprecated classes that are still fully functional but Sun would like you to move to the new ones.  My biggest gripe on this is the Date classes.  Date is deprecated and they want you to go through the Calendar interface now.  But Date still works and is a lot simpler.  In practical terms I don't know whether they'd turn it off since Date is embedded in so many apps.

Thursday, June 10, 2004

If "Deprecation" annoys you turn it off at the command line. I find the new Calendar classes a lot more usefull than the old ones. Infact I have a whole lot of guys working in different modules telling me I want your function to give me date in this format and and that format. I use SimpleDateformat class and keep everyone happy. Everyone gets what they want.

Friday, June 11, 2004

I think you'll find there's quite a few java developers on this forum.

There's nothing stopping you using deprecrated methods, although it's possible your compiler/IDE may refuse to compile any further when it encounters this warning. This would not be the norm, however.

I stand corrected, but to my knowledge, Sun have never actually removed a deprecated method. I've tended to treat deprecation as a style guide.

Friday, June 11, 2004

"... to my knowledge, Sun have never actually removed a deprecated method."

*makes uncomfortable face*

Yesss, while *technically* true, it's not practically true.  I don't know of any deprecated methods they've actually removed, but they have changed some to simply abort (throw a java.lang.Error).  For somebody trying to write a program using them, this isn't much better than simply removing them.  (I guess it means that old programs will still compile cleanly, only to fail when run.  Um, yay?)

For example, System.getenv() now (at least, as of 1.4.1) throws a java.lang.Error "getenv no longer supported, use properties and -D instead".

(This basically meant that my program became useless, without some sort of wrapper to convert envs to command-line flags, which would defeat its platform-independence.  It's one of the many things that convinced me to abandon Java.)

Friday, June 11, 2004

*  Recent Topics

*  Fog Creek Home