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

javascript 'Set' cannot handle wrapped java objects properly #1387

Merged

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
3 checks passed
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