Why is java.util.Date's setTime() method not deprecated?

calendar, date, deprecated, java, time

Solution

The bits of `Date` that were deprecated were those bits that related to calendars (i.e. day, month, year, etc). You'll note that the accessor methods for calendar fields are also deprecated, not just the mutators.

The representation as a milliseconds value, however, is still the way `Date` works, and is unrelated to the calendar representation, so it stayed as undeprecated.

Problem

All the other mutators got deprecated back in JDK 1.1, so why was `setTime()` left as is? Surely `java.util.Calendar` - the correct way to manipulate dates - can create new instances of `java.util.Date` as needed using the `java.util.Date(long)` constructor?

Original source