Why is there still deprecated content in JDK like Thread.stop()
?
On the documentation site here I can see the method is
@Deprecated(since=”1.2″)
Since 1.2!
Also, there is a note:
This method is inherently unsafe
So why is it still there? The presence of deprecated code can potentially lead to many issues.
Advertisement
Answer
There is a whole page from Oracle talking about deprecation in APIs if you want to read about it, but here is a good snippet which sums up why deprecated functions are still in Java:
Deprecation is a reasonable choice in all these cases because it preserves “backward compatibility” while encouraging developers to change to the new API. Also, the deprecation comments help developers decide when to move to the new API, and so should briefly mention the technical reasons for deprecation.
Eventually, it will be removed, but until there is enough confidence that people are not using programs that still utilse Thread.stop()
, they will keep it in there, and just let people know that there are much better options to choose from.