JavaMoney / jsr354-ri

JSR 354 - Moneta: Reference Implementation
Other
344 stars 101 forks source link

JDKCurrencyAdapter hashCode prevents interoperable implementations #314

Closed marschall closed 5 years ago

marschall commented 5 years ago

CurrencyUnit defines equality in terms of #getCurrencyCode() and JDKCurrencyAdapter#equals follows this specification. However JDKCurrencyAdapter#hashCode does not and uses JDK Currency #hashCode which uses #hashCode from Object which makes it impossible to implement a currency that is equal to JDKCurrencyAdapter and has the same

Also there were same unnecessary null checks in hashCode and equals methods.


This change is Reviewable