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 2009/07/02 22:33:47 UTC

[jira] Commented: (THRIFT-532) Implicit enum value generation is incorrect

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

Bryan Duxbury commented on THRIFT-532:
--------------------------------------

Hm, this is a good one. I haven't looked at your patch in detail yet, but I am wondering, beyond fixing problems, will this change the numbering of people's existing constants? If so, we must proceed with utmost caution with whatever fix we incorporate.

> Implicit enum value generation is incorrect
> -------------------------------------------
>
>                 Key: THRIFT-532
>                 URL: https://issues.apache.org/jira/browse/THRIFT-532
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (General)
>    Affects Versions: 0.2
>            Reporter: Ying-Yi Liang
>            Priority: Minor
>         Attachments: enum_value.diff
>
>
> For languages without native enum support (e.g. Java, PHP...), the Thrift compiler automatically assigns a value to enum members without explicit values. The current algorithm assumes explicit values are in ascending order, which does not always hold...
> See below for a violation case:
> enum ValueCollision {
>    TWO,
>    ONE = 1,
>    THREE
> }
> The implicit value of TWO collides with ONE...A simple solution is to make the smallest implicit value greater than the largest explicit value.

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