You are currently browsing the Philipp Meier's weblog blog archives for November, 2003


Same shortcut key, different meaning.

Darren Hobbs: Best post ever, you’ll never know

Yes, yes, yes, I know this situation… I often loose bug reports because I want do select the “last” word and *poff* mozilla closes the window. I think of changing the close-window shortcut key for mozilla.
Idea rules but ctrl-w is dangerous for a unix user :-9


Braindead Long.hashCode?

Did anyone expect Long(-1).hashCode() to return -1? It seems to me that new Long(o).hashCode() == o is an invariant in sun j2sdk1.4. I spent 2 hours looking for the error in my unit test until if found this one:

The two test object instances I used differed only in one property. It was null in one instance and a new Long(0) in the other. The hashcode always ware the same because commons-lang’s HashCodebuilder does sth. like

hashCode += 37  * (fielda == null ? 0 : fielda.hashCode())

Oh my. Never never use a special value like "0" in your unit test.