[ 
https://issues.apache.org/jira/browse/THRIFT-2115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13731610#comment-13731610
 ] 

Randy Abernethy commented on THRIFT-2115:
-----------------------------------------

Hello Jeff: 

I agree with the undercurrent here, which is reordering the set could be 
surprising to the user. However the definitive set is a thing without order. 
Depending on set order across languages gets tricky.

You are probably familiar with the Java sorted containers option provided by 
the compiler:
$ thrift -gen java:sorted_containers my.thrift

C++ has a similar-but-different feature allowing the exact implementation 
container to be specified but within the IDL using the cpp_type keyword. I 
think both of these features would be better off if replaced by language 
specific annotations in the IDL. This would make the approach consistent across 
languages (using annotations), get rid of the odd ball C++ only keyword and 
open up the Java solution (not o mention other languages) to using any 
container you like (be it TreeSet, LinkedHashSet or HashSet).
                
> Use LinkedHashSet instead of HashSet in generated java rpc code
> ---------------------------------------------------------------
>
>                 Key: THRIFT-2115
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2115
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Java - Compiler
>    Affects Versions: 0.9
>            Reporter: Jeff Nelson
>
> Generated java code that returns a generic Set<?> should use a LinkedHashSet 
> instead of a HashSet so that the iteration order is maintained from server to 
> client.

--
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

Reply via email to