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

Vadim Chekan commented on THRIFT-1212:
--------------------------------------

> If you do nothing but change names, it'll work just fine. 
Didn't know that, thanks.

> add a constraint that says structs can't have members with the same name
If you mean thrift generator itself, yes, this would simplify things by 
removing the root of the problem. Do I understand it correctly, that existing 
projects will be forced to adjust names and it won't break their backward 
compatibility?

On the other hand, idl in example is valid, because class name is "Order" and 
member name is "order", so they are different. It is C# generator which 
upper-case members which breaks things. So another option is to not pascal-case 
members (or classes) at all in C# generator.

> Members capital case conflict
> -----------------------------
>
>                 Key: THRIFT-1212
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1212
>             Project: Thrift
>          Issue Type: Bug
>          Components: C# - Compiler
>    Affects Versions: 0.6.1
>         Environment: Windows 7
>            Reporter: Vadim Chekan
>            Priority: Minor
>
> When generating "csharp" target off the following structure:
> ===
> struct Order {
>   1: string col,  // sort column name
>   2: i32    order // asc(1) or desc(0)
> }
> ===
> the code is generated:
> class Order { public int Order ...
> This code fails to compile in C# compiler because member name is the same as 
> containing clsss  name, which is invalid in C#.
> Perhaps there must be a check when generating members and if capitalized 
> member name turns out to be the same as containing class name, then prepend 
> it with underscore.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to