Error with Jakarta-commons HashCodeBuilder

I found interesting error in the code, which was very difficult to find out:

--------------------------------------------
return new HashCodeBuilder()
        .append(param1)
        .append(param2)
        .hashCode();
--------------------------------------------

This code is working incorrectly - it calculates different hash-code every time. This happening, because method ".hashCode()" is called on instance of class "HashCodeBuilder".

Instead of ".hashCode()" is needed to use ".toHashCode()".

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.