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

return of filterKeys is not serializable #6654

Closed
scabug opened this issue Nov 12, 2012 · 8 comments
Closed

return of filterKeys is not serializable #6654

scabug opened this issue Nov 12, 2012 · 8 comments

Comments

@scabug
Copy link

scabug commented Nov 12, 2012

Return of filterKeys is not serializable. I'm not sure this is intended behaviour or a bug, but it's possible to confuse users. Attached file throws following exception:

java.io.NotSerializableException: scala.collection.immutable.MapLike$$anon$1
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at Test$delayedInit$body.apply(Test.scala:13)

@scabug
Copy link
Author

scabug commented Nov 12, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6654?orig=1
Reporter: @ihji
Affected Versions: 2.10.0-RC2
See #4776
Attachments:

  • Test.scala (created on Nov 12, 2012 4:57:21 AM UTC, 397 bytes)

@scabug
Copy link
Author

scabug commented Jan 30, 2013

@rklaehn said:
filterKeys and mapValues basically return views that reference the original collection and a filter predicate instead of creating an entirely new collection. So it is no wonder they are not serializable.

Fix #4776 by either returning a MapView or returning an entirely new Map, and the issue will solve itself.

@scabug
Copy link
Author

scabug commented Mar 25, 2013

@Blaisorblade said:
In the meantime, a more direct solution:
https://groups.google.com/d/topic/scala-internals/oso5yrKV5ds/discussion

@scabug
Copy link
Author

scabug commented Jul 10, 2013

@adriaanm said:
Unassigning and rescheduling to M6 as previous deadline was missed.

@scabug
Copy link
Author

scabug commented Mar 7, 2015

Eran Medan (eranation) said (edited on Mar 7, 2015 10:11:07 AM UTC):
This causes interesting bugs when using with Spark...
Used -Dsun.io.serialization.extendedDebugInfo=true and the way to here was short
Anything I can do to help? isn't this a simple fix? (I saw some pull requests... anything wrong with them?)

@scabug
Copy link
Author

scabug commented Dec 18, 2015

@dragos said:
I agree it's very surprising. At least a more prominent note in Scaladoc? Would that be accepted as a PR?

@Blaisorblade
Copy link

Copying tags from #7005 since collections are being worked upon @szeiger @julienrf.

@Blaisorblade Blaisorblade modified the milestones: Backlog, 2.13.0-M4 Mar 2, 2018
@Blaisorblade
Copy link

Feel free to reassign but these issues belong together.

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

5 participants