diff options
author | Simon Ochsenreither <simon@ochsenreither.de> | 2013-04-24 15:00:58 +0200 |
---|---|---|
committer | Simon Ochsenreither <simon@ochsenreither.de> | 2013-04-25 14:02:42 +0200 |
commit | bdae05f94ef319d1eb1c20b5b84c8febf2f69aca (patch) | |
tree | 81ec5483d15fc44425f1a919dc53689254f7fe6b /src/library | |
parent | b291e28c75f73fa6f2949503bc4d17948422d705 (diff) | |
download | scala-bdae05f94ef319d1eb1c20b5b84c8febf2f69aca.tar.gz scala-bdae05f94ef319d1eb1c20b5b84c8febf2f69aca.tar.bz2 scala-bdae05f94ef319d1eb1c20b5b84c8febf2f69aca.zip |
SI-7403 Stream extends Serializable
Additionally, add @deprecatedInheritance to warn creators of
custom subclasses that the class will be sealed in the future.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/immutable/Stream.scala | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala index 0770bd3175..104f6a7fb1 100644 --- a/src/library/scala/collection/immutable/Stream.scala +++ b/src/library/scala/collection/immutable/Stream.scala @@ -183,10 +183,12 @@ import scala.language.implicitConversions * @define orderDependentFold * @define willTerminateInf Note: lazily evaluated; will terminate for infinite-sized collections. */ +@deprecatedInheritance("This class will be sealed.", "2.11.0") abstract class Stream[+A] extends AbstractSeq[A] with LinearSeq[A] with GenericTraversableTemplate[A, Stream] - with LinearSeqOptimized[A, Stream[A]] { + with LinearSeqOptimized[A, Stream[A]] + with Serializable { self => override def companion: GenericCompanion[Stream] = Stream @@ -1048,7 +1050,7 @@ object Stream extends SeqFactory[Stream] { def result: Stream[A] = parts.toStream flatMap (_.toStream) } - object Empty extends Stream[Nothing] with Serializable { + object Empty extends Stream[Nothing] { override def isEmpty = true override def head = throw new NoSuchElementException("head of empty stream") override def tail = throw new UnsupportedOperationException("tail of empty stream") @@ -1099,7 +1101,7 @@ object Stream extends SeqFactory[Stream] { /** A lazy cons cell, from which streams are built. */ @SerialVersionUID(-602202424901551803L) - final class Cons[+A](hd: A, tl: => Stream[A]) extends Stream[A] with Serializable { + final class Cons[+A](hd: A, tl: => Stream[A]) extends Stream[A] { override def isEmpty = false override def head = hd @volatile private[this] var tlVal: Stream[A] = _ |