I’m not sure if I’m alone on this opinion, but it sure seems to me that the deprecation of the finalize method has been given way too much press. I can’t recall this much fervor over method deprecation since they blacklisted the java.util.Date() constructor and told everyone to start using a GregorianCalendar instead.
Giving the term ‘deprecated’ meaning
Whenever deprecated Java methods become news, I always like to troll the language gods over the fact that even though methods get deprecated, the underlying code never actually gets removed from the API, and as a result, lazy developers just keep using it, deprecation warnings be damned.
In a recent blog post, entitled Deprecation of Object.finalize(), Oracle Technical Staff Principal Stuart Marks set the record straight not only on what was being deprecated in Java 9, but which deprecated methods were actually being pruned from the API as well. Here’s the pertinent excerpt from his article:
The following six APIs were deprecated in Java SE 8, and they have been removed from Java SE 9:
In addition, in Java SE 9, about 20 methods and six modules have been deprecated with forRemoval=true, indicating our intent to remove them from the next major Java SE release. Some of the classes and methods to be removed include:
The modules deprecated for removal are the following:
So yes, we are getting serious about removing stuff!
Deprecated value != deprecated meaning
So I guess that will shut me up for a while. They’re getting around to pruning the API and getting rid of the deprecated methods. All I ask is that they don’t prune away that deprecated java.util.Date constructor. I’m still writing code that uses it.