Skip to content

Conversation

@rPraml
Copy link
Contributor

@rPraml rPraml commented Sep 12, 2023

When adding java objects to a javascript Set(), they are not deduplicated.

This is caused, because Java objects are wrapped each time in a new NativeObject. As NativeObject has no hashcode/equals they are inserted multiple times in a Set

This PR adds equals+hashcode to NativeObject and a testcase, where the same enum is added twice to a set and the expected size is 1.

@gbrail
Copy link
Collaborator

gbrail commented Oct 6, 2023

Makes sense to me -- thanks!

@gbrail gbrail merged commit dd9c638 into mozilla:master Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants