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


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.

Reply via email to