When are API methods marked "deprecated" actually going to go away?

One problem is you'll see lots of compiler warnings about using deprecated methods. If you also use deprecations to gradually phase out your own code, the compiler warnings will get lost in the noise and lose significance.


They're not going away. That said, they're usually deprecated because a) they're dangerous ala Thread.stop(), or b) there is a better or at least more accepted way to do it. Usually deprecated method javadoc will give you a hint as to the better way. In your case, Calendar is the recommended way to do this.

While it's conceivable that they will be removed at some point in the future, I wouldn't bet on it. If anyone ever forks Java however, they'll probably be the first thing to go...


Regarding the APIs, ... it is not specified they will be removed anytime soon.

Incompatibilities in J2SE 5.0 (since 1.4.2):

Source Compatibility

[...]
In general, the policy is as follows, except for any incompatibilities listed further below:

Deprecated APIs are interfaces that are supported only for backwards compatibility. The javac compiler generates a warning message whenever one of these is used, unless the -nowarn command-line option is used. It is recommended that programs be modified to eliminate the use of deprecated APIs, though there are no current plans to remove such APIs – with the exception of JVMDI and JVMPI – entirely from the system.

Even in its How and When To Deprecate APIs, nothing is being said about a policy regarding actually removing the deprected APIs...


Update 10 years later, the new JDK9+ Enhanced Deprecation clarifies the depreciation policy.
See Jens Bannmann's answer for more details.
This is also detailed in this blog post by Vojtěch Růžička, following criticisms on JEP 277.

The convention for JDK is that once a JDK API is marked as forRemoval=true in a certain Java version, it will be removed in the directly following major Java release.
That means - when something is marked as forRemoval=true in Java 9, it is supposed to be completely removed in Java 10.
Keep that in mind when using API marked for removal.

Note that this convention applies only to JDK itself and third-party libraries are free to choose any convention they see fit.

Tags:

Java

Date