Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.9
-
None
-
MacOS X, ruby 1.9 and 2.0
Description
Thrift::Union violates the contract for the :== method, by assuming that the passed argument is either nil or a Thrift::Union (by calling methods that only exist on Thrift::Union). An extra clause should be put in to test if it is not a Union and fail.
Idiomatically, this should be done via duck typing making the method be:
def ==(other)
nil && other.repond_to?(:get_set_field) && other.respond_to?(:get_value) && @setfield == other.get_set_field && @value == other.get_value
end
Attachments
Issue Links
- duplicates
-
THRIFT-3176 Union incorrectly implements ==
- Closed
- is related to
-
THRIFT-3176 Union incorrectly implements ==
- Closed