Navigation Menu

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

Most of the methods in Synchronized collections aren't synchronized! #7925

Closed
scabug opened this issue Oct 20, 2013 · 5 comments
Closed

Most of the methods in Synchronized collections aren't synchronized! #7925

scabug opened this issue Oct 20, 2013 · 5 comments

Comments

@scabug
Copy link

scabug commented Oct 20, 2013

Synchronized collections are broken in their design and, even worst, they currently don't fullfil their contract, i.e., most of the methods aren't synchronized!

Here is a comment in SynchronizedMap that should definitely make you nervous:

todo: also add all other methods.

Similar comments can be found in the other Synchronized collection traits.

Furthermore, these traits are broken in design as ticket #6087 demonstrates.

For the above reasons, I'd highly recommend to 1) add the missing synchronized methods, and 2) deprecate all Synchronized collection traits before shipping 2.11.

However, I realize that providing synchronized collections may still be desiderable (not everyone may be happy to migrate toward a concurrent collection - though, I'd like to know what's the argument for that). For this reason, I think we could provide Synchronized wrappers like Java does. This won't help people that were mixing a Synchronized trait with other collection traits, but I really don't see how we could allow that, and still prevent users from shooting themselves in the foot. If you have a great idea, please do share it.

This ticket is based on the following discussion https://groups.google.com/forum/#!topic/scala-internals/1gCbqTRCxAQ

@scabug
Copy link
Author

scabug commented Oct 20, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7925?orig=1
Reporter: @dotta
Affected Versions: 2.10.0, 2.11.0-M6

@scabug
Copy link
Author

scabug commented Oct 20, 2013

@retronym said:
Merging with #4290

@scabug scabug closed this as completed Oct 20, 2013
@scabug
Copy link
Author

scabug commented Oct 20, 2013

@dotta said:
@jason I noticed #4290, but I believe the ticket I've opened has a broader scope - I'm not suggesting to "just" fix the current implementation of the Synchronized collections, but actually deprecate and eventually remove them.

@scabug
Copy link
Author

scabug commented Oct 20, 2013

@retronym said:
That course of action might also be best for Forwarders and Proxies.

@scabug
Copy link
Author

scabug commented Oct 20, 2013

@dotta said:
Sounds good! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant