cushon / issues-import

0 stars 0 forks source link

Prefer getNumber() to ordinal() on com.google.protobuf.ProtocolMessageEnum #237

Open cushon opened 9 years ago

cushon commented 9 years ago

Original issue created by schwardo@google.com on 2014-03-07 at 02:52 PM


Enumerations specified in Protocol Buffers (https://code.google.com/p/protobuf/) are translated to subclasses of java.lang.Enum. However, the numeric value specified in the protocol value does not map to the numeric value of the Java enumeration. Instead, a getNumber() method is provided on the ProtocolMessageEnum interface, which provides access to the numeric value as specified in the .proto definition.

Any use of ordinal() on a class that implements ProtocolMessageEnum is probably a bug, and may lead to incorrect behavior.

cushon commented 9 years ago

Original comment posted by eaftan@google.com on 2014-03-18 at 12:50 AM


(No comment entered for this change.)


Status: Started Owner: schwardo@google.com