-
Notifications
You must be signed in to change notification settings - Fork 92
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
Serialization in 2.13.0-M5 #254
Comments
I don't know enough about the broad consequences to promote this to a Scala bug with a minimal example, although it seems it should. As is, we would need to have a mix-in trait that would provide I'm surprised this wasn't caught earlier in the community build. If the issue is scala/scala#6676 as @xuwei-k states, then it would have been an issue since it was merged on May-25. If true, then scala-xml in the community build was producing a false positive and giving a false sense of security? I'm not surprised that it didn't get caught in the compiler test suite since scala-xml and a few tests were removed early in M5 scala/scala#6436 on Apr-25. Some partests for XML literals were added back in scala/scala#6569 on Apr-27, but they wouldn't have caught this serialization issue. |
excluded some tests in community-builds 😢 |
minimal example package example
import java.io._
class MyCollection[B](val list: List[B]) extends scala.collection.Iterable[B] {
override def iterator = list.iterator
// protected[this] override def writeReplace(): AnyRef = this
}
object Main {
def write[A](o: A): Array[Byte] = {
val ba = new ByteArrayOutputStream(512)
val out = new ObjectOutputStream(ba)
out.writeObject(o)
out.close()
ba.toByteArray()
}
def read[A](buffer: Array[Byte]): A = {
val in = new ObjectInputStream(new ByteArrayInputStream(buffer))
in.readObject().asInstanceOf[A]
}
def main(args: Array[String]): Unit = {
val list = List(1, 2, 3)
// success
assert(read[List[Int]](write(list)) == list)
// fail
assert(read[MyCollection[Int]](write(new MyCollection(list))).list == list)
}
} |
cc @szeiger |
umbrella ticket for serialization issue(s) in 2.13: scala/scala-dev#562 |
bug report officially filed scala/bug#11192 |
I just closed the 2.13 WIP pull request that included the strange workaround for this Scala 2.13 bug, but it would be great to take it out in the future. |
scala/scala#7624 cements the new serialization scheme, so this isn't going to be "fixed" any further on the Scala end. the typical workarounds are to either:
sbt 1.3 will use a flatter classloader structure that we believe will make the |
The specific serialization issue was fixed, so we can close. I should have done that after merging #276. |
I tried compiling on the latest M5 with Seth's branch and get serialization issues:
When I look in the last passing 2.13 community build from Aug-22 I only see scala-xml getting skipped:
According to @xuwei-k in comment in scala-xml#253, the issue is related to changes
I'm not sure how @xuwei-k found this so quickly, but indeed xuwei-k/scala-xml@97bc6b4 fixed my issue.
The text was updated successfully, but these errors were encountered: