File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
compat/src/main/scala-2.11_2.12/scala/collection/compat/immutable Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import scala.collection.generic.{
33
33
SeqFactory
34
34
}
35
35
import scala .collection .immutable .{LinearSeq , NumericRange }
36
- import scala .collection .mutable .{ArrayBuffer , Builder , StringBuilder }
36
+ import scala .collection .mutable .{Builder , StringBuilder }
37
37
import scala .language .implicitConversions
38
38
39
39
/** This class implements an immutable linked list that evaluates elements
@@ -1512,14 +1512,17 @@ object LazyList extends SeqFactory[LazyList] {
1512
1512
1513
1513
private [this ] def readObject (in : ObjectInputStream ): Unit = {
1514
1514
in.defaultReadObject()
1515
- val init = new ArrayBuffer [A ]
1515
+ val init = new mutable. ListBuffer [A ]
1516
1516
var initRead = false
1517
1517
while (! initRead) in.readObject match {
1518
1518
case SerializeEnd => initRead = true
1519
- case a => init += a.asInstanceOf [A ]
1519
+ case a => init += a.asInstanceOf [A ]
1520
1520
}
1521
1521
val tail = in.readObject().asInstanceOf [LazyList [A ]]
1522
- coll = tail.prependedAllToLL(init)
1522
+ // scala/scala#10118: caution that no code path can evaluate `tail.state`
1523
+ // before the resulting LazyList is returned
1524
+ val it = init.toList.iterator
1525
+ coll = newLL(stateFromIteratorConcatSuffix(it)(tail.state))
1523
1526
}
1524
1527
1525
1528
private [this ] def readResolve (): Any = coll
You can’t perform that action at this time.
0 commit comments