summaryrefslogtreecommitdiff
path: root/src/library/scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-03-19 17:32:37 +0000
committerPaul Phillips <paulp@improving.org>2011-03-19 17:32:37 +0000
commit4380911a32eb7fa99faf5fea4ba5f9ad6a3a5258 (patch)
tree6f85fb000c50936d6d0ea5c19b9eede435b4eaec /src/library/scala
parent01203c2844e196696b8fe35acfae0ee6ede90ffa (diff)
downloadscala-4380911a32eb7fa99faf5fea4ba5f9ad6a3a5258.tar.gz
scala-4380911a32eb7fa99faf5fea4ba5f9ad6a3a5258.tar.bz2
scala-4380911a32eb7fa99faf5fea4ba5f9ad6a3a5258.zip
Removed long deprecated and obscure CloneableCo...
Removed long deprecated and obscure CloneableCollection. Discovered we have a scala.collection.mutable.Cloneable which does not extend java.lang.Cloneable, which is why Array is not considered cloneable. That seems wrong, but to be conservative I gave Array the Cloneable interface without altering the scala trait. Also, if @serializable is deprecated in favor of Serializable, should not @cloneable be deprecated analogously? Closes #4307, and a commit-question review by rytz.
Diffstat (limited to 'src/library/scala')
-rw-r--r--src/library/scala/Array.scala47
-rw-r--r--src/library/scala/collection/mutable/Cloneable.scala3
-rw-r--r--src/library/scala/collection/mutable/CloneableCollection.scala22
3 files changed, 18 insertions, 54 deletions
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index 7183d9a473..1bdc5b23c9 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -415,7 +415,7 @@ object Array extends FallbackArrayBuilding {
def unapplySeq[T](x: Array[T]): Option[IndexedSeq[T]] =
if (x == null) None else Some(x.toIndexedSeq)
// !!! the null check should to be necessary, but without it 2241 fails. Seems to be a bug
- // in pattern matcher.
+ // in pattern matcher. @PP: I noted in #4364 I think the behavior is correct.
/** Creates an array containing several copies of an element.
*
@@ -483,7 +483,7 @@ object Array extends FallbackArrayBuilding {
* @author Martin Odersky
* @version 1.0
*/
-final class Array[T](_length: Int) extends java.io.Serializable {
+final class Array[T](_length: Int) extends java.io.Serializable with java.lang.Cloneable {
/** Multidimensional array creation */
@deprecated("use `Array.ofDim' instead")
@@ -545,43 +545,28 @@ final class Array[T](_length: Int) extends java.io.Serializable {
def length: Int = throw new Error()
/** The element at given index.
- * <p>
- * Indices start a `0`; `xs.apply(0)` is the first
- * element of array `xs`.
- * </p>
- * <p>
- * Note the indexing syntax `xs(i)` is a shorthand for
- * `xs.apply(i)`.
- * </p>
*
- * @param i the index
- * @throws ArrayIndexOutOfBoundsException if `i < 0` or
- * `length <= i`
+ * Indices start at `0`; `xs.apply(0)` is the first element of array `xs`.
+ * Note the indexing syntax `xs(i)` is a shorthand for `xs.apply(i)`.
+ *
+ * @param i the index
+ * @return the element at the given index
+ * @throws ArrayIndexOutOfBoundsException if `i < 0` or `length <= i`
*/
def apply(i: Int): T = throw new Error()
- /** <p>
- * Update the element at given index.
- * </p>
- * <p>
- * Indices start a `0`; `xs.apply(0)` is the first
- * element of array `xs`.
- * </p>
- * <p>
- * Note the indexing syntax `xs(i) = x` is a shorthand
- * for `xs.update(i, x)`.
- * </p>
+ /** Update the element at given index.
+ *
+ * Indices start at `0`; `xs.apply(0)` is the first element of array `xs`.
+ * Note the indexing syntax `xs(i)` is a shorthand for `xs.apply(i)`.
*
- * @param i the index
- * @param x the value to be written at index `i`
- * @throws ArrayIndexOutOfBoundsException if `i < 0` or
- * `length <= i`
+ * @param i the index
+ * @param x the value to be written at index `i`
+ * @throws ArrayIndexOutOfBoundsException if `i < 0` or `length <= i`
*/
def update(i: Int, x: T) { throw new Error() }
- /** <p>
- * Clone the Array.
- * </p>
+ /** Clone the Array.
*
* @return A clone of the Array.
*/
diff --git a/src/library/scala/collection/mutable/Cloneable.scala b/src/library/scala/collection/mutable/Cloneable.scala
index 15c245fde0..28bf2ceb8e 100644
--- a/src/library/scala/collection/mutable/Cloneable.scala
+++ b/src/library/scala/collection/mutable/Cloneable.scala
@@ -18,6 +18,7 @@ package mutable
* @tparam A Type of the elements contained in the collection, covariant and with reference types as upperbound.
*/
@cloneable
-trait Cloneable[+A <: AnyRef] {
+trait Cloneable[+A <: AnyRef] {
+ // !!! why doesn't this extend java.lang.Cloneable?
override def clone: A = super.clone().asInstanceOf[A]
}
diff --git a/src/library/scala/collection/mutable/CloneableCollection.scala b/src/library/scala/collection/mutable/CloneableCollection.scala
deleted file mode 100644
index 8659842b71..0000000000
--- a/src/library/scala/collection/mutable/CloneableCollection.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.collection
-package mutable
-
-/** The J2ME version of the library defined this trait with a `clone`
- * method to substitute for the lack of `Object.clone` there.
- *
- * @since 2.6
- */
-@deprecated("use Cloneable instead")
-trait CloneableCollection {
- override def clone(): AnyRef = super.clone()
-}