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

Do not replace Map.of() by Collections.emptyMap() #1106

Closed
C-Otto opened this issue Nov 9, 2022 · 3 comments
Closed

Do not replace Map.of() by Collections.emptyMap() #1106

C-Otto opened this issue Nov 9, 2022 · 3 comments

Comments

@C-Otto
Copy link
Contributor

C-Otto commented Nov 9, 2022

My code always returns an empty map, implemented using Map.of(). When running pitest, this is mutated to return Collections.emptyMap() instead. As I don't have any test that would be able to see the difference, this mutation survived.

Please treat Map.of() the same as Collections.emptySet(), i.e. do not try to mutate one into the other.

Version 1.9.9.

@hcoles
Copy link
Owner

hcoles commented Nov 9, 2022

The EquivalentReturns filter already catches List.of and Set.of, not sure why Map.of was missed. Will be fixed in the next release.

@C-Otto
Copy link
Contributor Author

C-Otto commented Nov 10, 2022

You added the "Collections.emptyMap()" return value in 89b0c2c, after Set.of() and List.of() were already known as "empty" equivalent.

@hcoles
Copy link
Owner

hcoles commented Nov 11, 2022

Released in 1.9.10

@hcoles hcoles closed this as completed Nov 11, 2022
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

No branches or pull requests

2 participants