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

Bryan Duxbury resolved THRIFT-763.
----------------------------------

         Assignee: Nathan Marz
    Fix Version/s: 0.3
       Resolution: Fixed

I just committed this patch. Good catch.

More generally, I think the problem is that we don't take more care to be sure 
that the field value instance variables are named in a unique and reliable way. 
Ideally, we could prefix all the vars with something like "__field_value_", but 
since we allow people to generate Java classes that don't have accessor 
methods, this would introduce some additional compiler work.

I think it's about that time when I recommend (again) that we stop offering a 
generator that doesn't hide the variables behind accessors in Java.

> Variable capture bug in generated struct compareTo
> --------------------------------------------------
>
>                 Key: THRIFT-763
>                 URL: https://issues.apache.org/jira/browse/THRIFT-763
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Nathan Marz
>            Assignee: Nathan Marz
>            Priority: Minor
>             Fix For: 0.3
>
>         Attachments: struct_compare.patch
>
>
> In the generated compareTo for structs, any field named "other" gets shadowed 
> by the local variable other. I've attached a patch to refer to the local 
> field explicitly using "this.".
> FYI, this is the second time I've run into a variable capture bug. We need to 
> be more careful w.r.t. generating local variables.

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

Reply via email to