You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2014/05/28 23:27:02 UTC

[jira] [Created] (THRIFT-2554) double initialization in generated Read() method

Jens Geyer created THRIFT-2554:
----------------------------------

             Summary: 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


{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)
  {
      //... more stuff ...
    while (true)
    {
      field = iprot.ReadFieldBegin();
      //... more stuff ...
      switch (field.ID)
      {
        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)