Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test IterableSubject methods on objects that don't implement hashCode() #176

Open
cpovirk opened this issue Mar 14, 2015 · 2 comments
Open
Labels
P3 not scheduled type=other Miscellaneous activities not covered by other type= labels

Comments

@cpovirk
Copy link
Member

cpovirk commented Mar 14, 2015

Such objects are at least a little evil, but they exist in one or two Google-internal projects. If we currently support this, then we should continue to do so, or at least we should have a test that lets us know that we're breaking it so that we don't do so by mistake.

@cpovirk
Copy link
Member Author

cpovirk commented Mar 14, 2015

By "don't implement hashCode()", I was thinking more of classes that implement it by throwing UnsupportedOperationException. But I just realized that the particular case I was worse, overriding equals() but not hashCode(). But I suppose that a test for the UnsupportedOperationException will test that, too, for better or for worse.

kluever added a commit that referenced this issue Apr 25, 2015
…elements

don't implement hashCode() (e.g., ProtoBuf's MessageSet!)

See []where the user can't use .containsExactlyElementsIn().

This at least partially addresses #176
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=89605122
kluever added a commit that referenced this issue Apr 25, 2015
…elements

don't implement hashCode() (e.g., ProtoBuf's MessageSet!)

This at least partially addresses #176
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=89605122
kluever added a commit that referenced this issue Apr 25, 2015
…elements

don't implement hashCode() (e.g., ProtoBuf's MessageSet!)

This at least partially addresses #176
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=89605122
@raghsriniv raghsriniv added the P3 not scheduled label Jun 24, 2019
@nick-someone nick-someone added the type=other Miscellaneous activities not covered by other type= labels label Aug 6, 2019
@cpovirk
Copy link
Member Author

cpovirk commented Jul 25, 2022

We just got a report internally that failing tests still call hashCode here:

stringValueToItemsToCheck.put(String.valueOf(itemToCheck), itemToCheck);

I wonder if we could get away with using an ArrayListMultimap (which I don't think would use hashCode) instead of a HashMultimap?

[Update: I did that.]

copybara-service bot pushed a commit that referenced this issue Jul 25, 2022
…hrow an exception.

We'd rather they didn't, but let's do what we can... :(

(progress toward #176)

RELNOTES=n/a
PiperOrigin-RevId: 463138856
copybara-service bot pushed a commit that referenced this issue Jul 25, 2022
…hrow an exception.

We'd rather they didn't, but let's do what we can... :(

(progress toward #176)

RELNOTES=n/a
PiperOrigin-RevId: 463143598
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 not scheduled type=other Miscellaneous activities not covered by other type= labels
Projects
None yet
Development

No branches or pull requests

3 participants