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

Bryan Duxbury updated THRIFT-632:
---------------------------------

    Attachment: thrift-632-v2.patch

Here's an incomplete solution to the problem. When I encounter a constant of an 
enum type, I store the identifier and generate code with that later on down the 
road. If it happens not to be one of the enumerated values in the enum type, 
then I check if it's a constant and fail otherwise.

I added some code so that libraries that don't support this behavior directly 
when rendering constants can still do the get_integer call, but it's not 
perfect. I think the problems I've run into are that when the constant is a map 
(and probably list or set), then there's no parsing step I've messed with yet 
that gives it the opportunity to inject the enum type, and the compiler fails. 
I think the solution is some sort of recursive enum type propagation thing in 
the code for const defs, but I'm not sure. 

I'd love input on this solution.

> 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-v2.patch, 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