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:55:03 UTC
[jira] [Commented] (THRIFT-2554) double initialization in generated
Read() method
[ https://issues.apache.org/jira/browse/THRIFT-2554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14011664#comment-14011664 ]
Jens Geyer commented on THRIFT-2554:
------------------------------------
The problem only occurs with {{list<>}} and {{set<>}}, interestingly not with {{map<>}}. Testcase and patch added.
> 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)