You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2008/12/05 16:30:44 UTC

[jira] Created: (THRIFT-226) Collections with binary keys or values break equals()

Collections with binary keys or values break equals()
-----------------------------------------------------

                 Key: THRIFT-226
                 URL: https://issues.apache.org/jira/browse/THRIFT-226
             Project: Thrift
          Issue Type: Bug
          Components: Compiler (Java)
            Reporter: Bryan Duxbury


In Java, byte[].equals tests object equality, not value equality. As a result, if you have two list<binary> (or set<binary>, or map<binary, binary> with the same values and you do TBase.equals(), two structs that match by value won't return true. If we're going to do value equality, which I think we should, then we should make this consistent with collection types.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-226) Collections with binary keys or values break equals()

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742126#action_12742126 ] 

Bryan Duxbury commented on THRIFT-226:
--------------------------------------

That's sort of what I was thinking, actually. I'll have to check on the specifics of ByteBuffer, but it's possible that it could fulfill all our needs here. 

> Collections with binary keys or values break equals()
> -----------------------------------------------------
>
>                 Key: THRIFT-226
>                 URL: https://issues.apache.org/jira/browse/THRIFT-226
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Bryan Duxbury
>             Fix For: 0.2
>
>
> In Java, byte[].equals tests object equality, not value equality. As a result, if you have two list<binary> (or set<binary>, or map<binary, binary> with the same values and you do TBase.equals(), two structs that match by value won't return true. If we're going to do value equality, which I think we should, then we should make this consistent with collection types.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-226) Collections with binary keys or values break equals()

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12653907#action_12653907 ] 

David Reiss commented on THRIFT-226:
------------------------------------

Ugh.  This is going to significantly increase the complexity of both the generator and generated code.

> Collections with binary keys or values break equals()
> -----------------------------------------------------
>
>                 Key: THRIFT-226
>                 URL: https://issues.apache.org/jira/browse/THRIFT-226
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Bryan Duxbury
>
> In Java, byte[].equals tests object equality, not value equality. As a result, if you have two list<binary> (or set<binary>, or map<binary, binary> with the same values and you do TBase.equals(), two structs that match by value won't return true. If we're going to do value equality, which I think we should, then we should make this consistent with collection types.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-226) Collections with binary keys or values break equals()

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742123#action_12742123 ] 

David Reiss commented on THRIFT-226:
------------------------------------

What would you guys think about using java.nio.ByteBuffer for the binary type?

> Collections with binary keys or values break equals()
> -----------------------------------------------------
>
>                 Key: THRIFT-226
>                 URL: https://issues.apache.org/jira/browse/THRIFT-226
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Bryan Duxbury
>             Fix For: 0.2
>
>
> In Java, byte[].equals tests object equality, not value equality. As a result, if you have two list<binary> (or set<binary>, or map<binary, binary> with the same values and you do TBase.equals(), two structs that match by value won't return true. If we're going to do value equality, which I think we should, then we should make this consistent with collection types.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-226) Collections with binary keys or values break equals()

Posted by "Nathan Marz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776637#action_12776637 ] 

Nathan Marz commented on THRIFT-226:
------------------------------------

I am for using ByteBuffer for the binary type. It's really the only good long-term solution, and I'm fine with it being non-backwards compatible. byte[] are just a giant pain to deal with right now and cause a lot of issues.

> Collections with binary keys or values break equals()
> -----------------------------------------------------
>
>                 Key: THRIFT-226
>                 URL: https://issues.apache.org/jira/browse/THRIFT-226
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Bryan Duxbury
>             Fix For: 0.2
>
>
> In Java, byte[].equals tests object equality, not value equality. As a result, if you have two list<binary> (or set<binary>, or map<binary, binary> with the same values and you do TBase.equals(), two structs that match by value won't return true. If we're going to do value equality, which I think we should, then we should make this consistent with collection types.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (THRIFT-226) Collections with binary keys or values break equals()

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury reassigned THRIFT-226:
------------------------------------

    Assignee: Bryan Duxbury

> Collections with binary keys or values break equals()
> -----------------------------------------------------
>
>                 Key: THRIFT-226
>                 URL: https://issues.apache.org/jira/browse/THRIFT-226
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>             Fix For: 0.4
>
>
> In Java, byte[].equals tests object equality, not value equality. As a result, if you have two list<binary> (or set<binary>, or map<binary, binary> with the same values and you do TBase.equals(), two structs that match by value won't return true. If we're going to do value equality, which I think we should, then we should make this consistent with collection types.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-226) Collections with binary keys or values break equals()

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-226:
---------------------------------

    Fix Version/s: 0.2

> Collections with binary keys or values break equals()
> -----------------------------------------------------
>
>                 Key: THRIFT-226
>                 URL: https://issues.apache.org/jira/browse/THRIFT-226
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Bryan Duxbury
>             Fix For: 0.2
>
>
> In Java, byte[].equals tests object equality, not value equality. As a result, if you have two list<binary> (or set<binary>, or map<binary, binary> with the same values and you do TBase.equals(), two structs that match by value won't return true. If we're going to do value equality, which I think we should, then we should make this consistent with collection types.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (THRIFT-226) Collections with binary keys or values break equals()

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury closed THRIFT-226.
--------------------------------

    Resolution: Fixed

> Collections with binary keys or values break equals()
> -----------------------------------------------------
>
>                 Key: THRIFT-226
>                 URL: https://issues.apache.org/jira/browse/THRIFT-226
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Bryan Duxbury
>            Assignee: Bryan Duxbury
>             Fix For: 0.4
>
>
> In Java, byte[].equals tests object equality, not value equality. As a result, if you have two list<binary> (or set<binary>, or map<binary, binary> with the same values and you do TBase.equals(), two structs that match by value won't return true. If we're going to do value equality, which I think we should, then we should make this consistent with collection types.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-226) Collections with binary keys or values break equals()

Posted by "Nathan Marz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12732255#action_12732255 ] 

Nathan Marz commented on THRIFT-226:
------------------------------------

For the same reason set<binary> is just plain broken in Java. Set won't enforce that the a particular byte[] value appear only once.

> Collections with binary keys or values break equals()
> -----------------------------------------------------
>
>                 Key: THRIFT-226
>                 URL: https://issues.apache.org/jira/browse/THRIFT-226
>             Project: Thrift
>          Issue Type: Bug
>          Components: Compiler (Java)
>            Reporter: Bryan Duxbury
>             Fix For: 0.2
>
>
> In Java, byte[].equals tests object equality, not value equality. As a result, if you have two list<binary> (or set<binary>, or map<binary, binary> with the same values and you do TBase.equals(), two structs that match by value won't return true. If we're going to do value equality, which I think we should, then we should make this consistent with collection types.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.