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

[jira] Updated: (THRIFT-716) Field names can conflict with local variables in code for unions

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

Bryan Duxbury updated THRIFT-716:
---------------------------------

    Attachment: thrift-716.patch

In looking at this issue, I realized that there's actually no reason to make the value to write a parameter to writeField, since the generated class will have access to the protected value variable in the base class. This patch reflects the removal of the value (and set field) parameters from the signature of writeField and updates to the generator accordingly.

What do you guys think?

> Field names can conflict with local variables in code for unions
> ----------------------------------------------------------------
>
>                 Key: THRIFT-716
>                 URL: https://issues.apache.org/jira/browse/THRIFT-716
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Nathan Marz
>         Attachments: thrift-716.patch
>
>
> Try creating a union with the field name "value", and the code won't compile. In writeFields for the generated class, you'll have something like the following:
> <code>
>       case VALUE:
>         String value = (String)getFieldValue();
>         oprot.writeString(value);
>         return;
> </code>
> "String value" conflicts with the parameter "Object value".

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.