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

scala.collection.convert.Wrappers$MapWrapper is not serializable #8911

Closed
scabug opened this issue Oct 15, 2014 · 6 comments
Closed

scala.collection.convert.Wrappers$MapWrapper is not serializable #8911

scabug opened this issue Oct 15, 2014 · 6 comments

Comments

@scabug
Copy link

scabug commented Oct 15, 2014

Scala Maps that are wrapped as Java Maps are not serializable because scala.collection.convert.Wrappers$MapWrapper is not serializable:

object Test extends App {
  import scala.collection.JavaConverters._

  def ser(a: AnyRef) =
    (new java.io.ObjectOutputStream(new java.io.ByteArrayOutputStream())).writeObject(a)

  val m = Map(1 -> 1).asJava
  ser(m)
  println("ok")
}

produces

java.io.NotSerializableException: scala.collection.convert.Wrappers$MapWrapper
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
	at Test$.ser(Test.scala:5)
	at Test$.delayedEndpoint$Test$1(Test.scala:8)

This is related to #5974

@scabug
Copy link
Author

scabug commented Oct 15, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8911?orig=1
Reporter: Josh Rosen (joshrosen)
Affected Versions: 2.10.4, 2.11.2
See #5974

@scabug
Copy link
Author

scabug commented Nov 25, 2014

@Ichoran said:
scala/scala#4163 but due to binary compatibility issues we might have to rebase on 2.12. Not sure what the policy is here, but I don't think there's a way to rescue serializability without destroying binary compatibility.

@scabug
Copy link
Author

scabug commented Nov 27, 2014

@Ichoran said:
Rebased on 2.12, new PR. scala/scala#4167

@scabug
Copy link
Author

scabug commented Apr 26, 2015

@Ichoran said:
Adriaan commented on pull, "For the new PR, please rephrase the commit title as an action on the codebase or a bullet item in the release notes ("SI-8911 allow serializing Scala Maps wrapped as Java ones")"

@scabug
Copy link
Author

scabug commented Jul 19, 2015

@Ichoran said:
Rebased.

@scabug
Copy link
Author

scabug commented Jul 19, 2015

@Ichoran said:
scala/scala#4647

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

2 participants