[
https://issues.apache.org/jira/browse/THRIFT-5056?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sylwester Lachiewicz resolved THRIFT-5056.
------------------------------------------
Resolution: Fixed
Generated GetHashCode hashes the instance fields via an Isset switch
([compiler/cpp/src/thrift/generate/t_netstd_generator.cc|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/generate/t_netstd_generator.cc]
lines 1948-1962) instead of the old constant-ish implementation. Resolving as
Fixed.
> Netstd Generated GetHashCode() returns same value in many common cases
> ----------------------------------------------------------------------
>
> Key: THRIFT-5056
> URL: https://issues.apache.org/jira/browse/THRIFT-5056
> Project: Thrift
> Issue Type: Bug
> Components: netstd - Compiler
> Affects Versions: 0.13.0
> Reporter: Emi
> Priority: Major
>
> Simple Thrift example which breaks the generated GetHashCode() implementation:
> {code:java}
> struct Simple
> {
> 1: optional bool A;
> 2: optional bool B;
> }
> {code}
> The generated GetHashCode() implementation using netstd generator returns the
> same value if one only of the A,B fields is set:
> {code:java}
> Assert.NotEqual(new Simple{A = true}.GetHashCode(), new Simple{B =
> true}.GetHashCode());
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)