[
https://issues.apache.org/jira/browse/THRIFT-532?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ying-Yi Liang updated THRIFT-532:
---------------------------------
Attachment: enum_value_less_agressive.diff
The more backward compatible method. If there was no enum value conflicts in
the original output, the new output after applying this patch should be the
same.
Errata to the original violation case:
enum Numberz {
ONE = 2,
TWO = 1,
THREE,
} // implicit value of THREE conflicts with TWO
> 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.
-
You can reply to this email to add a comment to the issue online.