diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-07-10 16:18:15 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-07-11 20:13:58 +0200 |
commit | 8e42c37dfb9ecdfc402fc91e319e1d189e683a81 (patch) | |
tree | 0a70e6829a10fb5f3ea0f90a25c2ae35f0788937 /src/library | |
parent | bbd48868a44a1336db8ff4b02ac78d8c6d497448 (diff) | |
download | scala-8e42c37dfb9ecdfc402fc91e319e1d189e683a81.tar.gz scala-8e42c37dfb9ecdfc402fc91e319e1d189e683a81.tar.bz2 scala-8e42c37dfb9ecdfc402fc91e319e1d189e683a81.zip |
SI-4763 Deprecated the `cloneable` annotation
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Cloneable.scala | 14 | ||||
-rw-r--r-- | src/library/scala/annotation/cloneable.scala | 3 | ||||
-rw-r--r-- | src/library/scala/collection/mutable/ArrayStack.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/mutable/Buffer.scala | 4 | ||||
-rw-r--r-- | src/library/scala/collection/mutable/BufferLike.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/mutable/Cloneable.scala | 5 | ||||
-rw-r--r-- | src/library/scala/collection/mutable/PriorityQueue.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/mutable/Queue.scala | 1 | ||||
-rw-r--r-- | src/library/scala/collection/mutable/Stack.scala | 1 | ||||
-rw-r--r-- | src/library/scala/package.scala | 1 |
10 files changed, 22 insertions, 13 deletions
diff --git a/src/library/scala/Cloneable.scala b/src/library/scala/Cloneable.scala new file mode 100644 index 0000000000..5ba76ddde5 --- /dev/null +++ b/src/library/scala/Cloneable.scala @@ -0,0 +1,14 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +package scala + +/** + * Classes extending this trait are cloneable across platforms (Java, .NET). + */ +trait Cloneable extends java.lang.Cloneable diff --git a/src/library/scala/annotation/cloneable.scala b/src/library/scala/annotation/cloneable.scala index 8a66f1839f..aa45e8325f 100644 --- a/src/library/scala/annotation/cloneable.scala +++ b/src/library/scala/annotation/cloneable.scala @@ -6,11 +6,10 @@ ** |/ ** \* */ - - package scala.annotation /** * An annotation that designates the class to which it is applied as cloneable */ +@deprecated("instead of `@cloneable class C`, use `class C extends Cloneable`", "2.10.0") class cloneable extends annotation.StaticAnnotation diff --git a/src/library/scala/collection/mutable/ArrayStack.scala b/src/library/scala/collection/mutable/ArrayStack.scala index 040a0e2aa7..8f834d265b 100644 --- a/src/library/scala/collection/mutable/ArrayStack.scala +++ b/src/library/scala/collection/mutable/ArrayStack.scala @@ -59,7 +59,7 @@ object ArrayStack extends SeqFactory[ArrayStack] { * @define mayNotTerminateInf * @define willNotTerminateInf */ -@cloneable @SerialVersionUID(8565219180626620510L) +@SerialVersionUID(8565219180626620510L) class ArrayStack[T] private(private var table : Array[AnyRef], private var index : Int) extends AbstractSeq[T] diff --git a/src/library/scala/collection/mutable/Buffer.scala b/src/library/scala/collection/mutable/Buffer.scala index dd225cfab9..fd5dc66292 100644 --- a/src/library/scala/collection/mutable/Buffer.scala +++ b/src/library/scala/collection/mutable/Buffer.scala @@ -28,10 +28,10 @@ import generic._ * @define Coll `Buffer` * @define coll buffer */ -@cloneable trait Buffer[A] extends Seq[A] with GenericTraversableTemplate[A, Buffer] - with BufferLike[A, Buffer[A]] { + with BufferLike[A, Buffer[A]] + with scala.Cloneable { override def companion: GenericCompanion[Buffer] = Buffer } diff --git a/src/library/scala/collection/mutable/BufferLike.scala b/src/library/scala/collection/mutable/BufferLike.scala index f82a596b32..3274fe6194 100644 --- a/src/library/scala/collection/mutable/BufferLike.scala +++ b/src/library/scala/collection/mutable/BufferLike.scala @@ -58,13 +58,13 @@ import annotation.{migration, bridge} * mutates the collection in place, unlike similar but * undeprecated methods throughout the collections hierarchy. */ -@cloneable trait BufferLike[A, +This <: BufferLike[A, This] with Buffer[A]] extends Growable[A] with Shrinkable[A] with Scriptable[A] with Subtractable[A, This] with SeqLike[A, This] + with scala.Cloneable { self : This => // Abstract methods from Seq: diff --git a/src/library/scala/collection/mutable/Cloneable.scala b/src/library/scala/collection/mutable/Cloneable.scala index e6fbce415a..6daac3094a 100644 --- a/src/library/scala/collection/mutable/Cloneable.scala +++ b/src/library/scala/collection/mutable/Cloneable.scala @@ -17,9 +17,6 @@ package mutable * * @tparam A Type of the elements contained in the collection, covariant and with reference types as upperbound. */ -@cloneable -trait Cloneable[+A <: AnyRef] { - // !!! why doesn't this extend java.lang.Cloneable? - // because neither did @serializable, then we changed it to Serializable +trait Cloneable[+A <: AnyRef] extends scala.Cloneable { override def clone: A = super.clone().asInstanceOf[A] } diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala index af55a01ed6..e37cbdc712 100644 --- a/src/library/scala/collection/mutable/PriorityQueue.scala +++ b/src/library/scala/collection/mutable/PriorityQueue.scala @@ -31,7 +31,6 @@ import generic._ * @define mayNotTerminateInf * @define willNotTerminateInf */ -@cloneable class PriorityQueue[A](implicit val ord: Ordering[A]) extends AbstractIterable[A] with Iterable[A] @@ -40,6 +39,7 @@ class PriorityQueue[A](implicit val ord: Ordering[A]) with Growable[A] with Builder[A, PriorityQueue[A]] with Serializable + with scala.Cloneable { import ord._ diff --git a/src/library/scala/collection/mutable/Queue.scala b/src/library/scala/collection/mutable/Queue.scala index 605d37aec6..2aa19d6cb0 100644 --- a/src/library/scala/collection/mutable/Queue.scala +++ b/src/library/scala/collection/mutable/Queue.scala @@ -30,7 +30,6 @@ import generic._ * @define mayNotTerminateInf * @define willNotTerminateInf */ -@cloneable class Queue[A] extends MutableList[A] with GenericTraversableTemplate[A, Queue] diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala index 042eac517a..db9e48d1cf 100644 --- a/src/library/scala/collection/mutable/Stack.scala +++ b/src/library/scala/collection/mutable/Stack.scala @@ -53,7 +53,6 @@ object Stack extends SeqFactory[Stack] { * @define mayNotTerminateInf * @define willNotTerminateInf */ -@cloneable class Stack[A] private (var elems: List[A]) extends AbstractSeq[A] with Seq[A] diff --git a/src/library/scala/package.scala b/src/library/scala/package.scala index 070ae26862..a41cdedfa9 100644 --- a/src/library/scala/package.scala +++ b/src/library/scala/package.scala @@ -37,6 +37,7 @@ package object scala { @deprecated("instead of `@serializable class C`, use `class C extends Serializable`", "2.9.0") type serializable = annotation.serializable + @deprecated("instead of `@cloneable class C`, use `class C extends Cloneable`", "2.10.0") type cloneable = annotation.cloneable type TraversableOnce[+A] = scala.collection.TraversableOnce[A] |