05/04: Primitives != myFriend
I almost forgot why I don't like primitives...but tonight, I received a gentle reminder. My dislike for primitives actually began some time ago. The short version is that the team was developing a business application, and the database layer would accept certain values and execute a query to save the data to the database (yes, this was quite a while ago). Problem was...when using primitives, there was no way to disinguish between 0 and null. Usually, it's important to distinguish between zero and null! Tonight, I was stung by primitives again.
I was compiling some code under 1.5 and trying to run under 1.4. It so happens that as part of a jsr, a new constructor was added to BigDecimal that accepts an int. This constructor is not present in earlier jdks. After reading through some mumbo jumbo about it not mattering that I specified my target as 1.4 because I'm still compiling against the 1.5 version of the library, I implemented a workaround (aka. HACK).
I convert everything to a String before passing it to the constructor of BigDecimal. Seems to work...but ugly.
I was compiling some code under 1.5 and trying to run under 1.4. It so happens that as part of a jsr, a new constructor was added to BigDecimal that accepts an int. This constructor is not present in earlier jdks. After reading through some mumbo jumbo about it not mattering that I specified my target as 1.4 because I'm still compiling against the 1.5 version of the library, I implemented a workaround (aka. HACK).
I convert everything to a String before passing it to the constructor of BigDecimal. Seems to work...but ugly.
(RSS 2.0)