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

David Reiss commented on THRIFT-632:
------------------------------------

+      const vector<t_enum_value*> enum_values = 
((t_enum*)type)->get_constants();

That should be a vector reference (add a & after the > ).

The main issues I see:

1/ No longer possible to have a constant value be the name of another constant. 
 I don't know if anyone is using this feature.
2/ Generated C++ code is broken since it uses get_integer() for enum constants.

One possible solution for #1 is to only make the constant an enum value if the 
constant lookup fails (and fail if any enum name matches a constant name).

One possible solution for #2 is to fix all of the generators.  Another is to 
replace set_identifier with a "set_enum" that sets both the enum name and the 
integer value.  This might require having access to the enumeration in the 
parser clause that reads the const value.  I can help with that if you want to 
go that route.  Also, it looks like we don't really verify constant value types 
anywhere, which is weird.

> Constants of enum types don't behave well
> -----------------------------------------
>
>                 Key: THRIFT-632
>                 URL: https://issues.apache.org/jira/browse/THRIFT-632
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>    Affects Versions: 0.2
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>             Fix For: 0.2
>
>         Attachments: thrift-632.patch
>
>
> It turns out that THRIFT-551 missed the case of constants defined of enum 
> types. 

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