You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static int abs(int) vs public static long abs(long):Are equal? falseHave same hashCode? true
This means that all hash-based collections will never store overloaded methods together, only the last added one.
I noticed that some MemberInfo-derived classes override isEquivalentTo, without touching hashCode.
I suppose that all classes overriding IsEquivalentTo, should override hashCode accordingly.
The text was updated successfully, but these errors were encountered:
The current implementation of
MethodInfo.hashCode
returns the same value for overloaded methods.As an example, below code
will print
This means that all hash-based collections will never store overloaded methods together, only the last added one.
I noticed that some
MemberInfo
-derived classes overrideisEquivalentTo
, without touchinghashCode
.I suppose that all classes overriding
IsEquivalentTo
, should overridehashCode
accordingly.The text was updated successfully, but these errors were encountered: