[
https://issues.apache.org/jira/browse/THRIFT-532?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer resolved THRIFT-532.
-------------------------------
Resolution: Invalid
Not an issue.
{code}
enum ValueCollision
{
FOO = 2,
BAR = 1,
BAZ
FUNNY
}
{code}
produces for all languages
{code}
FOO = 2,
BAR = 1,
BAZ = 2
FUNNY = 3
{code}
=> Expected behaviour. Enum values are not considered bijective in most (all?)
languages.
> 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, enum_value_less_agressive.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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira