Open adeloof2 opened 6 days ago
Thanks for the clear bug report!
We are able to internally confirm that the hashCode() accidentally mismatches on dynamicmessage vs gencode if you have zero-valued implicit presence fields (so, the issue won't reproduce on: proto2 syntax files, proto3 files where the scalar fields are marked 'optional', or where all of non-optional fields are set to a value other than zero).
We'll look into the best / safest way to fix this in a future release.
What version of protobuf and what language are you using? Version: protoc 28.3 / protobuf-java 4.28.3 Language: Java
What operating system (Linux, Windows, ...) and version? Windows 11
What runtime / compiler are you using (e.g., python version or gcc version) BellSoft Liberica 21.0.2
What did you do?
Output:
What did you expect to see The DynamicMessage's hashcode should be the same as the real message's hashcode since equals() returns true.
What did you see instead? The hashcodes are not the same. This issue only seems to happen if the message has a field which is not set.
Anything else we should know about your project / environment n/a