[ 
https://issues.apache.org/jira/browse/THRIFT-1742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13640690#comment-13640690
 ] 

Jens Geyer commented on THRIFT-1742:
------------------------------------

I really would like to commit this, but ...

1. I had some Problems applying to the current trunc, because of the Union 
patch (not your fault, but I want to mention that). 

2. The "hashcode" Option is missing in the help text at the end of the C# 
Generator. That's quite simple to fix, so not a big problem either.

3. What is really annoying is that I get warnings at generated lines like these:

{code}
    public override int GetHashCode() {
      int hashcode = 0;
      unchecked {
        hashcode = (hashcode * 397) ^(Value == null ? 0 : 
(Value.GetHashCode()));      }
      return hashcode;
    }
{code}

If Value is a basic type like i32, double or an enum, then the Compiler emits a 
"Warning: The result of the expression is always 'false' since a value of type 
'int' is never equal to 'null' of type 'int?'".

I used the following Options:

{code}
thrift  -v --gen csharp:serial,asyncctp,hashcode  somefile.thrift
{code}



                
> Optionally implement hashcode and equals in c#
> ----------------------------------------------
>
>                 Key: THRIFT-1742
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1742
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C# - Compiler
>            Reporter: T Jake Luciani
>            Assignee: Carl Yeksigian
>         Attachments: 1742.patch, 1742-v2.patch, 1742-v3.patch, 1742-v4.patch, 
> 1742-v5.patch, 1742-v6.patch
>
>
> It would be very helpful to have a compiler flag that implements hashCode and 
> equals for c# generated structs.  Java has this capability.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to