hashgraph / hashgraph/pbj

Ensure hash codes immutability

Open
#230 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
44
Forks
15
Avg merge
1d 15h
Merged PRs (30d)
12

Description

In PBJ, we often delegate to Java `Integer.hashCode()`, `Double.hashCode()`, `String.hashCode()` etc. when computing hash codes for PBJ models. While JDK implementations of those methods are unlikely to change, that might happen in theory. Since we persist the computed hash codes, ~we need to add some tests to get alerted if JDK starts computing different hash codes for the same input values.~

...we want to implement `hashCode()` for primitive types ourselves by borrowing the current implementations from JDK (so as to end up with the same numerical values for the hashes.) And then we want to make PBJ use our custom implementations instead of delegating to JDK implementations which may change from release to release, or from one JDK vendor implementation to another.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.