[ 
https://issues.apache.org/jira/browse/THRIFT-2554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jens Geyer closed THRIFT-2554.
------------------------------

    Resolution: Fixed

Committed.

> double initialization in generated Read() method
> ------------------------------------------------
>
>                 Key: THRIFT-2554
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2554
>             Project: Thrift
>          Issue Type: Bug
>          Components: C# - Compiler
>            Reporter: Jens Geyer
>            Assignee: Jens Geyer
>            Priority: Minor
>             Fix For: 0.9.2
>
>         Attachments: 
> THRIFT-2544_double_initialization_in_generated_Read_method.patch, 
> thrift-2554-double-init-testcase.thrift
>
>
> {code:title=IDL}
> struct Element {
>       1: string foobar
> }
> struct Test {
>       1: list<Element>  elms
> }
> {code}
> produces this code:
> {code:title=Test.cs}
> public partial class Test : TBase
> {
>   //... stuff ...
>   public void Read (TProtocol iprot)
>   {
>     //... stuff ...
>         case 1:
>           if (field.Type == TType.List) {
>             {
>               Elms = new List<Element>();
>               TList _list0 = iprot.ReadListBegin();
>               for( int _i1 = 0; _i1 < _list0.Count; ++_i1)
>               {
>                 Element _elem2 = new Element();    // <-- first instance
>                 _elem2 = new Element();            // <-- second instance
>                 _elem2.Read(iprot);
>                 Elms.Add(_elem2);
>               }
>               iprot.ReadListEnd();
>             }
>       //... more stuff ...
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to