Journal dmorin's Journal: A Java Rant
Pardon me while I rant.
My new consulting gig is still standardized on Java1.3 because of their app server. They give me a project to work on which is about 80% separate from everything else so I work it standalone on my laptop, using Java1.4 and deliberately staying away from 1.4's new features. I thought.
Today I put it back onto 1.3 and it crashes miserably.
Turns out that Calendar.getTimeInMillis() is available in 1.4 but protected in 1.3. Why? How should I know? The only subclass of Calendar, GregorianCalendar, does not make it public. And I'm not about to go throwing a new subclass of Calendar around strictly so I can get at the time. That's stupid. They must know it's stupid, that's why it's not protected anymore.
But there are always workarounds. Calendar has the getTime() method, which returns a Date object. Forget about how silly I find this (why is it not called getDate()?), but let's remember at this point that Date is 99% deprecated and pretty much exists only to be a placeholder for "current system time". Sure enough, Date *also* has a getTime() method, this one returning a long representing the number of milliseconds. Fine. Perfect.
So if you're ever looking at my code and a line like cal.getTime().getTime() causes you to pause and look at it funny, don't blame me.
A Java Rant More Login
A Java Rant
Slashdot Top Deals