Community
Participate
Working Groups
This is a minor point, but on the "Basic Techniques" page in the Programming Guide (http://www.eclipse.org/aspectj/doc/released/progguide/examples-basic.html), in the section "The HashablePoint aspect", it says "Different implementations [of hashCode] are allowed [to] return different integers, but must return distinct integers for distinct objects, and the same integer for objects that test equal." It is not true that hashCode must return distinct integers for distinct objects. It's preferable, since it makes the hashCode more useful (and may speed up hashtables, etc.), but it's not required. From the javadocs on Object.hashCode: "It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables." BTW, I didn't specify a version because I couldn't find a version number in the document.
we should tidy this up in the docs for 1.5.0...
i've updated the doc to address this, it no longer incorrectly states the hashCode() must be different for non-equal objects.