I’ve searched through the web and what I’ve found out is this:
To make the compiler warn you of the
details of which methods you used that
were deprecated use thejavac.exe
-deprecationswitch. Then look in the Javadoc for the deprecated methods to
find out the recommended replacements.
Sometimes you just have to rename.
Sometimes the replacements work quite
differently.
But I’m not really understand how it works, can anybody help me with this?
Method deprecation is done to warn programmers that the method is not currently the best one to use for the functionality that’s desired. It’s done by using the
@deprecatedjavadoc annotation. When you use the-deprecatedflag tojavac, it’s just tellingjavacto raise a warning when it sees these javadoc annotations. It tells you the line number where you used the deprecated method, and the name of the deprecated method.From there, it’s up to you to look at the JDK’s javadoc on Sun’s (er…Oracle’s) site to see what the recommendations are for getting the functionality you desire. Sometimes the replacement involves making multiple method calls, where you would have made just one in the past. Usually the documentation is good about giving you examples, and pointing you in the right direction when there’s a new way of doing things.