forked from netty/netty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes
EmptyByteBuf#hashCode
and AbstractByteBuf#hashCode
consiste…
…nt (netty#7870) Motivation: The `AbstractByteBuf#equals` method doesn't take into account the class of buffer instance. So the two buffers with different classes must have the same `hashCode` values if `equals` method returns `true`. But `EmptyByteBuf#hashCode` is not consistent with `#hashCode` of the empty `AbstractByteBuf`, that is violates the contract and can lead to errors. Modifications: Return `1` in `EmptyByteBuf#hashCode`. Result: Consistent behavior of `EmptyByteBuf#hashCode` and `AbstractByteBuf#hashCode`.
- Loading branch information
1 parent
f874a37
commit 81a7d14
Showing
3 changed files
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters