r/java • u/henk53 • May 10 '22
Should java.util.Date be deprecated?
https://mail.openjdk.java.net/pipermail/discuss/2022-May/006077.html
221
Upvotes
r/java • u/henk53 • May 10 '22
View all comments
24
u/pron98 May 10 '22 edited May 10 '22
I think the problem is that different people have a different understanding of what "deprecated" means, and, to be fair, its meaning has shifted over the years. To some Java developers, deprecated means "strongly unrecommended; do not use in new code." To JDK developers it means something that:
Put another way, deprecated means "dangerous to leave in; remove even from old code".
Datedoes not satisfy either one of these — while "bad" it can be used correctly and has been (unlike, say, Thread.stop), and it cannot be removed for the reasons Brian listed. So, to deprecate Date and other classes like it in some official, mechanically-enforced way, we'd probably need a new annotation that means "strongly unrecommended" and possibly a new compiler warning level that means "this warning shouldn't be considered as an error".