diff options
151 files changed, 362 insertions, 2538 deletions
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala index aaaf5691f1..735c13190b 100644 --- a/src/actors/scala/actors/Future.scala +++ b/src/actors/scala/actors/Future.scala @@ -27,14 +27,6 @@ abstract class Future[+T] extends Responder[T] with Function0[T] { private[actors] var fvalue: Option[Any] = None private[actors] def fvalueTyped = fvalue.get.asInstanceOf[T] - @deprecated("this member is going to be removed in a future release", "2.8.0") - def ch: InputChannel[Any] = inputChannel - - @deprecated("this member is going to be removed in a future release", "2.8.0") - protected def value: Option[Any] = fvalue - @deprecated("this member is going to be removed in a future release", "2.8.0") - protected def value_=(x: Option[Any]) { fvalue = x } - /** Tests whether the future's result is available. * * @return `true` if the future's result is available, diff --git a/src/actors/scala/actors/Scheduler.scala b/src/actors/scala/actors/Scheduler.scala index 0729ff5bc8..591828ba10 100644 --- a/src/actors/scala/actors/Scheduler.scala +++ b/src/actors/scala/actors/Scheduler.scala @@ -37,25 +37,4 @@ object Scheduler extends DelegatingScheduler { Debug.info(this+": starting new "+sched+" ["+sched.getClass+"]") sched } - - /* Only `ForkJoinScheduler` implements this method. - */ - @deprecated("snapshot will be removed", "2.8.0") - def snapshot() { - if (sched.isInstanceOf[ForkJoinScheduler]) { - sched.asInstanceOf[ForkJoinScheduler].snapshot() - } else - sys.error("scheduler does not implement snapshot") - } - - /* Only `ForkJoinScheduler` implements this method. - */ - @deprecated("restart will be removed", "2.8.0") - def restart() { - if (sched.isInstanceOf[ForkJoinScheduler]) { - sched.asInstanceOf[ForkJoinScheduler].restart() - } else - sys.error("scheduler does not implement restart") - } - } diff --git a/src/actors/scala/actors/package.scala b/src/actors/scala/actors/package.scala index 1fd9fd7699..d809816ff6 100644 --- a/src/actors/scala/actors/package.scala +++ b/src/actors/scala/actors/package.scala @@ -19,29 +19,4 @@ package object actors { // type of Reactors tracked by termination detector private[actors] type TrackedReactor = Reactor[A] forSome { type A >: Null } - - @deprecated("use scheduler.ForkJoinScheduler instead", "2.8.0") - type FJTaskScheduler2 = scala.actors.scheduler.ForkJoinScheduler - - @deprecated("use scheduler.ForkJoinScheduler instead", "2.8.0") - type TickedScheduler = scala.actors.scheduler.ForkJoinScheduler - - @deprecated("use scheduler.ForkJoinScheduler instead", "2.8.0") - type WorkerThreadScheduler = scala.actors.scheduler.ForkJoinScheduler - - @deprecated("this class is going to be removed in a future release", "2.8.0") - type WorkerThread = java.lang.Thread - - @deprecated("use scheduler.SingleThreadedScheduler instead", "2.8.0") - type SingleThreadedScheduler = scala.actors.scheduler.SingleThreadedScheduler - - // This used to do a blind cast and throw a CCE after the package - // object was loaded. I have replaced with a variation that should work - // in whatever cases that was working but fail less exceptionally for - // those not intentionally using it. - @deprecated("this value is going to be removed in a future release", "2.8.0") - val ActorGC = scala.actors.Scheduler.impl match { - case x: scala.actors.scheduler.ActorGC => x - case _ => null - } } diff --git a/src/actors/scala/actors/remote/RemoteActor.scala b/src/actors/scala/actors/remote/RemoteActor.scala index f6ef62bc10..23cbae8532 100644 --- a/src/actors/scala/actors/remote/RemoteActor.scala +++ b/src/actors/scala/actors/remote/RemoteActor.scala @@ -81,10 +81,6 @@ object RemoteActor { kern } - @deprecated("this member is going to be removed in a future release", "2.8.0") - def createKernelOnPort(port: Int): NetKernel = - createNetKernelOnPort(port) - /** * Registers <code>a</code> under <code>name</code> on this * node. @@ -120,10 +116,6 @@ object RemoteActor { private[remote] def someNetKernel: NetKernel = kernels.valuesIterator.next - - @deprecated("this member is going to be removed in a future release", "2.8.0") - def someKernel: NetKernel = - someNetKernel } diff --git a/src/build/genprod.scala b/src/build/genprod.scala index c0543cdcf8..557cbc65de 100644 --- a/src/build/genprod.scala +++ b/src/build/genprod.scala @@ -238,7 +238,7 @@ class Function(val i: Int) extends Group("Function") with Arity { curryComment + " def curried: %s => R = {\n %s\n }\n".format( targs mkString " => ", body - ) + """ @deprecated("Use `curried` instead", "2.8.0")""" + "\n def curry = curried\n" + ) } override def moreMethods = curryMethod + tupleMethod diff --git a/src/compiler/scala/reflect/internal/pickling/ByteCodecs.scala b/src/compiler/scala/reflect/internal/pickling/ByteCodecs.scala index 1add69ddd4..4670bd4eef 100644 --- a/src/compiler/scala/reflect/internal/pickling/ByteCodecs.scala +++ b/src/compiler/scala/reflect/internal/pickling/ByteCodecs.scala @@ -122,9 +122,6 @@ object ByteCodecs { dst } - @deprecated("use 2-argument version instead", "2.8.0") - def decode7to8(src: Array[Byte], srclen: Int, dstlen: Int) { decode7to8(src, srclen) } - def decode7to8(src: Array[Byte], srclen: Int): Int = { var i = 0 var j = 0 @@ -193,9 +190,6 @@ object ByteCodecs { def encode(xs: Array[Byte]): Array[Byte] = avoidZero(encode8to7(xs)) - @deprecated("use 1-argument version instead", "2.8.0") - def decode(xs: Array[Byte], dstlen: Int) { decode(xs) } - /** * Destructively decodes array xs and returns the length of the decoded array. * diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala index 087fa07617..ae0dd68dfd 100644 --- a/src/library/scala/Array.scala +++ b/src/library/scala/Array.scala @@ -230,7 +230,7 @@ object Array extends FallbackArrayBuilding { * * Note that this means that `elem` is computed a total of n times: * {{{ - * scala> Array.fill(3){ java.lang.Math.random } + * scala> Array.fill(3){ math.random } * res3: Array[Double] = Array(0.365461167592537, 1.550395944913685E-4, 0.7907242137333306) * }}} * @@ -423,65 +423,6 @@ object Array extends FallbackArrayBuilding { 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. @PP: I noted in #4364 I think the behavior is correct. - - /** Creates an array containing several copies of an element. - * - * @param n the length of the resulting array - * @param elem the element composing the resulting array - * @return an array composed of n elements all equal to elem - */ - @deprecated("use `Array.fill` instead", "2.8.0") - def make[T: ClassManifest](n: Int, elem: T): Array[T] = { - val a = new Array[T](n) - var i = 0 - while (i < n) { - a(i) = elem - i += 1 - } - a - } - - /** Creates an array containing the values of a given function `f` - * over given range `[0..n)` - */ - @deprecated("use `Array.tabulate` instead", "2.8.0") - def fromFunction[T: ClassManifest](f: Int => T)(n: Int): Array[T] = { - val a = new Array[T](n) - var i = 0 - while (i < n) { - a(i) = f(i) - i += 1 - } - a - } - - /** Creates an array containing the values of a given function `f` - * over given range `[0..n1, 0..n2)` - */ - @deprecated("use `Array.tabulate` instead", "2.8.0") - def fromFunction[T: ClassManifest](f: (Int, Int) => T)(n1: Int, n2: Int): Array[Array[T]] = - fromFunction(i => fromFunction(f(i, _))(n2))(n1) - - /** Creates an array containing the values of a given function `f` - * over given range `[0..n1, 0..n2, 0..n3)` - */ - @deprecated("use `Array.tabulate` instead", "2.8.0") - def fromFunction[T: ClassManifest](f: (Int, Int, Int) => T)(n1: Int, n2: Int, n3: Int): Array[Array[Array[T]]] = - fromFunction(i => fromFunction(f(i, _, _))(n2, n3))(n1) - - /** Creates an array containing the values of a given function `f` - * over given range `[0..n1, 0..n2, 0..n3, 0..n4)` - */ - @deprecated("use `Array.tabulate` instead", "2.8.0") - def fromFunction[T: ClassManifest](f: (Int, Int, Int, Int) => T)(n1: Int, n2: Int, n3: Int, n4: Int): Array[Array[Array[Array[T]]]] = - fromFunction(i => fromFunction(f(i, _, _, _))(n2, n3, n4))(n1) - - /** Creates an array containing the values of a given function `f` - * over given range `[0..n1, 0..n2, 0..n3, 0..n4, 0..n5)` - */ - @deprecated("use `Array.tabulate` instead", "2.8.0") - def fromFunction[T: ClassManifest](f: (Int, Int, Int, Int, Int) => T)(n1: Int, n2: Int, n3: Int, n4: Int, n5: Int): Array[Array[Array[Array[Array[T]]]]] = - fromFunction(i => fromFunction(f(i, _, _, _, _))(n2, n3, n4, n5))(n1) } /** Arrays are mutable, indexed collections of values. `Array[T]` is Scala's representation @@ -529,38 +470,6 @@ object Array extends FallbackArrayBuilding { */ final class Array[T](_length: Int) extends java.io.Serializable with java.lang.Cloneable { - /** Multidimensional array creation */ - @deprecated("use `Array.ofDim` instead", "2.8.0") - def this(dim1: Int, dim2: Int) = this(dim1) - - /** Multidimensional array creation */ - @deprecated("use `Array.ofDim` instead", "2.8.0") - def this(dim1: Int, dim2: Int, dim3: Int) = this(dim1) - - /** Multidimensional array creation */ - @deprecated("use `Array.ofDim` instead", "2.8.0") - def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int) = this(dim1) - - /** Multidimensional array creation */ - @deprecated("use `Array.ofDim` instead", "2.8.0") - def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int, dim5: Int) = this(dim1) - - /** Multidimensional array creation */ - @deprecated("use `Array.ofDim` instead", "2.8.0") - def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int, dim5: Int, dim6: Int) = this(dim1) - - /** Multidimensional array creation */ - @deprecated("use `Array.ofDim` instead", "2.8.0") - def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int, dim5: Int, dim6: Int, dim7: Int) = this(dim1) - - /** Multidimensional array creation */ - @deprecated("use `Array.ofDim` instead", "2.8.0") - def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int, dim5: Int, dim6: Int, dim7: Int, dim8: Int) = this(dim1) - - /** Multidimensional array creation */ - @deprecated("use `Array.ofDim` instead", "2.8.0") - def this(dim1: Int, dim2: Int, dim3: Int, dim4: Int, dim5: Int, dim6: Int, dim7: Int, dim8: Int, dim9: Int) = this(dim1) - /** The length of the array */ def length: Int = throw new Error() diff --git a/src/library/scala/Boolean.scala b/src/library/scala/Boolean.scala index f77bdd2ea0..dd5439d537 100755 --- a/src/library/scala/Boolean.scala +++ b/src/library/scala/Boolean.scala @@ -17,17 +17,93 @@ package scala * which provides useful non-primitive operations. */ final class Boolean extends AnyVal { + /** + * Negates a Boolean expression. + * + * - `!a` results in `false` if and only if `a` evaluates to `true` and + * - `!a` results in `true` if and only if `a` evaluates to `false`. + * + * @return the negated expression + */ def unary_! : Boolean = sys.error("stub") + /** + * Compares two Boolean expressions and returns `true` if they evaluate to the same value. + * + * `a == b` returns `true` if and only if + * - `a` and `b` are `true` or + * - `a` and `b` are `false`. + */ def ==(x: Boolean): Boolean = sys.error("stub") + + /** + * Compares two Boolean expressions and returns `true` if they evaluate to a different value. + * + * `a != b` returns `true` if and only if + * - `a` is `true` and `b` is `false` or + * - `a` is `false` and `b` is `true`. + */ def !=(x: Boolean): Boolean = sys.error("stub") + + /** + * Compares two Boolean expressions and returns `true` if one or both of them evaluate to true. + * + * `a || b` returns `true` if and only if + * - `a` is `true` or + * - `b` is `true` or + * - `a` and `b` are `true`. + * + * @note This method uses 'short-circuit' evaluation and + * behaves as if it was declared as `def ||(x: => Boolean): Boolean`. + * If `a` evaluates to `true`, `true` is returned without evaluating `b`. + */ def ||(x: Boolean): Boolean = sys.error("stub") + + /** + * Compares two Boolean expressions and returns `true` if both of them evaluate to true. + * + * `a && b` returns `true` if and only if + * - `a` and `b` are `true`. + * + * @note This method uses 'short-circuit' evaluation and + * behaves as if it was declared as `def &&(x: => Boolean): Boolean`. + * If `a` evaluates to `false`, `false` is returned without evaluating `b`. + */ def &&(x: Boolean): Boolean = sys.error("stub") + // Compiler won't build with these seemingly more accurate signatures // def ||(x: => Boolean): Boolean = sys.error("stub") // def &&(x: => Boolean): Boolean = sys.error("stub") + + /** + * Compares two Boolean expressions and returns `true` if one or both of them evaluate to true. + * + * `a | b` returns `true` if and only if + * - `a` is `true` or + * - `b` is `true` or + * - `a` and `b` are `true`. + * + * @note This method evaluates both `a` and `b`, even if the result is already determined after evaluating `a`. + */ def |(x: Boolean): Boolean = sys.error("stub") + + /** + * Compares two Boolean expressions and returns `true` if both of them evaluate to true. + * + * `a & b` returns `true` if and only if + * - `a` and `b` are `true`. + * + * @note This method evaluates both `a` and `b`, even if the result is already determined after evaluating `a`. + */ def &(x: Boolean): Boolean = sys.error("stub") + + /** + * Compares two Boolean expressions and returns `true` if they evaluate to a different value. + * + * `a ^ b` returns `true` if and only if + * - `a` is `true` and `b` is `false` or + * - `a` is `false` and `b` is `true`. + */ def ^(x: Boolean): Boolean = sys.error("stub") def getClass(): Class[Boolean] = sys.error("stub") diff --git a/src/library/scala/Cell.scala b/src/library/scala/Cell.scala deleted file mode 100644 index f1e7dc8d86..0000000000 --- a/src/library/scala/Cell.scala +++ /dev/null @@ -1,21 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - - -package scala - -/** A `Cell` is a generic wrapper which completely - * hides the functionality of the wrapped object. The wrapped - * object is accessible via the `elem` accessor method. - * - * @author Martin Odersky - * @version 1.0, 08/08/2003 - */ -@deprecated("use `scala.Option` or `scala.Some` instead", "2.9.0") -case class Cell[+T](elem: T) diff --git a/src/library/scala/CountedIterator.scala b/src/library/scala/CountedIterator.scala deleted file mode 100644 index 6f2c597169..0000000000 --- a/src/library/scala/CountedIterator.scala +++ /dev/null @@ -1,24 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - - -package scala - -/** Counted iterators keep track of the number of elements seen so far - * - * @since 2.0 - */ -@deprecated("use iterator.zipWithIndex instead", "2.8.0") -trait CountedIterator[+A] extends Iterator[A] { - /** counts the elements in this iterator; counts start at 0 - */ - def count: Int - - override def counted : this.type = this -} diff --git a/src/library/scala/Either.scala b/src/library/scala/Either.scala index e0f840a609..21d4d5c855 100644 --- a/src/library/scala/Either.scala +++ b/src/library/scala/Either.scala @@ -310,24 +310,6 @@ object Either { } } - @deprecated("use `x.joinLeft'", "2.8.0") - def joinLeft[A, B](es: Either[Either[A, B], B]) = - es.left.flatMap(x => x) - - @deprecated("use `x.joinRight'", "2.8.0") - def joinRight[A, B](es: Either[A, Either[A, B]]) = - es.right.flatMap(x => x) - - /** - * Takes an `Either` to its contained value within `Left` or - * `Right`. - */ - @deprecated("use `x.merge'", "2.8.0") - def merge[T](e: Either[T, T]) = e match { - case Left(t) => t - case Right(t) => t - } - /** If the condition satisfies, return the given `A` in `Left`, * otherwise, return the given `B` in `Right`. */ diff --git a/src/library/scala/Function.scala b/src/library/scala/Function.scala index 0e2d357892..23224b27e8 100644 --- a/src/library/scala/Function.scala +++ b/src/library/scala/Function.scala @@ -45,41 +45,6 @@ object Function { override def lift: T => Option[R] = f } - /** Currying for functions of arity 2. This transforms a function - * of arity 2 into a a unary function returning another unary function. - * - * @param f ... - * @return ... - */ - @deprecated("Use `f.curried` instead", "2.8.0") - def curried[a1, a2, b](f: (a1, a2) => b): a1 => a2 => b = { - x1 => x2 => f(x1, x2) - } - - /** Currying for functions of arity 3. - * - * @param f ... - * @return ... - */ - @deprecated("Use `f.curried` instead", "2.8.0") - def curried[a1, a2, a3, b](f: (a1, a2, a3) => b): a1 => a2 => a3 => b = { - x1 => x2 => x3 => f(x1, x2, x3) - } - - /** Currying for functions of arity 4. - */ - @deprecated("Use `f.curried` instead", "2.8.0") - def curried[a1, a2, a3, a4, b](f: (a1, a2, a3, a4) => b): a1 => a2 => a3 => a4 => b = { - x1 => x2 => x3 => x4 => f(x1, x2, x3, x4) - } - - /** Currying for functions of arity 5. - */ - @deprecated("Use `f.curried` instead", "2.8.0") - def curried[a1, a2, a3, a4, a5, b](f: (a1, a2, a3, a4, a5) => b): a1 => a2 => a3 => a4 => a5 => b = { - x1 => x2 => x3 => x4 => x5 => f(x1, x2, x3, x4, x5) - } - /** Uncurrying for functions of arity 2. This transforms a unary function * returning another unary function into a function of arity 2. */ diff --git a/src/library/scala/Function0.scala b/src/library/scala/Function0.scala index a3220f9752..f68bbcc454 100644 --- a/src/library/scala/Function0.scala +++ b/src/library/scala/Function0.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ // GENERATED CODE: DO NOT EDIT. -// genprod generated these sources at: Thu Apr 14 13:08:25 PDT 2011 +// genprod generated these sources at: Sun Jul 31 00:37:30 CEST 2011 package scala diff --git a/src/library/scala/Function10.scala b/src/library/scala/Function10.scala index 632883f518..6f17606afd 100644 --- a/src/library/scala/Function10.scala +++ b/src/library/scala/Function10.scala @@ -26,8 +26,6 @@ trait Function10[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, +R] extends def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 10 arguments, * it accepts a single [[scala.Tuple10]] argument. diff --git a/src/library/scala/Function11.scala b/src/library/scala/Function11.scala index 1c27ac757c..7a73bd35bf 100644 --- a/src/library/scala/Function11.scala +++ b/src/library/scala/Function11.scala @@ -26,8 +26,6 @@ trait Function11[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, +R] ex def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 11 arguments, * it accepts a single [[scala.Tuple11]] argument. diff --git a/src/library/scala/Function12.scala b/src/library/scala/Function12.scala index 7f53d87b33..c099c0436a 100644 --- a/src/library/scala/Function12.scala +++ b/src/library/scala/Function12.scala @@ -26,8 +26,6 @@ trait Function12[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 12 arguments, * it accepts a single [[scala.Tuple12]] argument. diff --git a/src/library/scala/Function13.scala b/src/library/scala/Function13.scala index 9e05c6c69a..f13db28f30 100644 --- a/src/library/scala/Function13.scala +++ b/src/library/scala/Function13.scala @@ -26,8 +26,6 @@ trait Function13[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 13 arguments, * it accepts a single [[scala.Tuple13]] argument. diff --git a/src/library/scala/Function14.scala b/src/library/scala/Function14.scala index 5dae9116b3..d0345cc552 100644 --- a/src/library/scala/Function14.scala +++ b/src/library/scala/Function14.scala @@ -26,8 +26,6 @@ trait Function14[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 14 arguments, * it accepts a single [[scala.Tuple14]] argument. diff --git a/src/library/scala/Function15.scala b/src/library/scala/Function15.scala index b50974a868..69ff039f5b 100644 --- a/src/library/scala/Function15.scala +++ b/src/library/scala/Function15.scala @@ -26,8 +26,6 @@ trait Function15[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 15 arguments, * it accepts a single [[scala.Tuple15]] argument. diff --git a/src/library/scala/Function16.scala b/src/library/scala/Function16.scala index 2dc726126b..d544d89303 100644 --- a/src/library/scala/Function16.scala +++ b/src/library/scala/Function16.scala @@ -26,8 +26,6 @@ trait Function16[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 16 arguments, * it accepts a single [[scala.Tuple16]] argument. diff --git a/src/library/scala/Function17.scala b/src/library/scala/Function17.scala index 520c9d1288..16c71e7ada 100644 --- a/src/library/scala/Function17.scala +++ b/src/library/scala/Function17.scala @@ -26,8 +26,6 @@ trait Function17[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 17 arguments, * it accepts a single [[scala.Tuple17]] argument. diff --git a/src/library/scala/Function18.scala b/src/library/scala/Function18.scala index 8d72a3f487..dfd70c2353 100644 --- a/src/library/scala/Function18.scala +++ b/src/library/scala/Function18.scala @@ -26,8 +26,6 @@ trait Function18[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 18 arguments, * it accepts a single [[scala.Tuple18]] argument. diff --git a/src/library/scala/Function19.scala b/src/library/scala/Function19.scala index 3990bc60d6..63decd03ad 100644 --- a/src/library/scala/Function19.scala +++ b/src/library/scala/Function19.scala @@ -26,8 +26,6 @@ trait Function19[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 19 arguments, * it accepts a single [[scala.Tuple19]] argument. diff --git a/src/library/scala/Function2.scala b/src/library/scala/Function2.scala index 7d0b9a5195..a4ad87fa97 100644 --- a/src/library/scala/Function2.scala +++ b/src/library/scala/Function2.scala @@ -39,8 +39,6 @@ trait Function2[@specialized(scala.Int, scala.Long, scala.Double) -T1, @speciali def curried: T1 => T2 => R = { (x1: T1) => (x2: T2) => apply(x1, x2) } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 2 arguments, * it accepts a single [[scala.Tuple2]] argument. diff --git a/src/library/scala/Function20.scala b/src/library/scala/Function20.scala index 94fa1cf56e..7219c9be81 100644 --- a/src/library/scala/Function20.scala +++ b/src/library/scala/Function20.scala @@ -26,8 +26,6 @@ trait Function20[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 20 arguments, * it accepts a single [[scala.Tuple20]] argument. diff --git a/src/library/scala/Function21.scala b/src/library/scala/Function21.scala index f41d8899fc..c7d55960db 100644 --- a/src/library/scala/Function21.scala +++ b/src/library/scala/Function21.scala @@ -26,8 +26,6 @@ trait Function21[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => T21 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20, x21: T21) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 21 arguments, * it accepts a single [[scala.Tuple21]] argument. diff --git a/src/library/scala/Function22.scala b/src/library/scala/Function22.scala index c1b290ff33..196421c830 100644 --- a/src/library/scala/Function22.scala +++ b/src/library/scala/Function22.scala @@ -26,8 +26,6 @@ trait Function22[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, -T10, -T11, -T12, def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => T10 => T11 => T12 => T13 => T14 => T15 => T16 => T17 => T18 => T19 => T20 => T21 => T22 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17, x18: T18, x19: T19, x20: T20, x21: T21, x22: T22) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 22 arguments, * it accepts a single [[scala.Tuple22]] argument. diff --git a/src/library/scala/Function3.scala b/src/library/scala/Function3.scala index 1b592f5c88..09a5aa5828 100644 --- a/src/library/scala/Function3.scala +++ b/src/library/scala/Function3.scala @@ -26,8 +26,6 @@ trait Function3[-T1, -T2, -T3, +R] extends AnyRef { self => def curried: T1 => T2 => T3 => R = { (x1: T1) => (x2: T2) => (x3: T3) => apply(x1, x2, x3) } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 3 arguments, * it accepts a single [[scala.Tuple3]] argument. diff --git a/src/library/scala/Function4.scala b/src/library/scala/Function4.scala index bd1123276b..00da84636a 100644 --- a/src/library/scala/Function4.scala +++ b/src/library/scala/Function4.scala @@ -26,8 +26,6 @@ trait Function4[-T1, -T2, -T3, -T4, +R] extends AnyRef { self => def curried: T1 => T2 => T3 => T4 => R = { (x1: T1) => (x2: T2) => (x3: T3) => (x4: T4) => apply(x1, x2, x3, x4) } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 4 arguments, * it accepts a single [[scala.Tuple4]] argument. diff --git a/src/library/scala/Function5.scala b/src/library/scala/Function5.scala index af83dcf303..3915048906 100644 --- a/src/library/scala/Function5.scala +++ b/src/library/scala/Function5.scala @@ -26,8 +26,6 @@ trait Function5[-T1, -T2, -T3, -T4, -T5, +R] extends AnyRef { self => def curried: T1 => T2 => T3 => T4 => T5 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5) => self.apply(x1, x2, x3, x4, x5)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 5 arguments, * it accepts a single [[scala.Tuple5]] argument. diff --git a/src/library/scala/Function6.scala b/src/library/scala/Function6.scala index caceb55c33..183a7332e1 100644 --- a/src/library/scala/Function6.scala +++ b/src/library/scala/Function6.scala @@ -26,8 +26,6 @@ trait Function6[-T1, -T2, -T3, -T4, -T5, -T6, +R] extends AnyRef { self => def curried: T1 => T2 => T3 => T4 => T5 => T6 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => self.apply(x1, x2, x3, x4, x5, x6)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 6 arguments, * it accepts a single [[scala.Tuple6]] argument. diff --git a/src/library/scala/Function7.scala b/src/library/scala/Function7.scala index 16aa9a90b6..10f8e9b599 100644 --- a/src/library/scala/Function7.scala +++ b/src/library/scala/Function7.scala @@ -26,8 +26,6 @@ trait Function7[-T1, -T2, -T3, -T4, -T5, -T6, -T7, +R] extends AnyRef { self => def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => self.apply(x1, x2, x3, x4, x5, x6, x7)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 7 arguments, * it accepts a single [[scala.Tuple7]] argument. diff --git a/src/library/scala/Function8.scala b/src/library/scala/Function8.scala index 6f97cc182b..8144b36101 100644 --- a/src/library/scala/Function8.scala +++ b/src/library/scala/Function8.scala @@ -26,8 +26,6 @@ trait Function8[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, +R] extends AnyRef { sel def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 8 arguments, * it accepts a single [[scala.Tuple8]] argument. diff --git a/src/library/scala/Function9.scala b/src/library/scala/Function9.scala index 3c39cb472b..ee04ed0915 100644 --- a/src/library/scala/Function9.scala +++ b/src/library/scala/Function9.scala @@ -26,8 +26,6 @@ trait Function9[-T1, -T2, -T3, -T4, -T5, -T6, -T7, -T8, -T9, +R] extends AnyRef def curried: T1 => T2 => T3 => T4 => T5 => T6 => T7 => T8 => T9 => R = { (x1: T1) => ((x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => self.apply(x1, x2, x3, x4, x5, x6, x7, x8, x9)).curried } - @deprecated("Use 'curried' instead", "2.8.0") - def curry = curried /** Creates a tupled version of this function: instead of 9 arguments, * it accepts a single [[scala.Tuple9]] argument. diff --git a/src/library/scala/Math.scala b/src/library/scala/Math.scala deleted file mode 100644 index 87db3ea877..0000000000 --- a/src/library/scala/Math.scala +++ /dev/null @@ -1,95 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - -package scala - -/** The object `Math` contains methods for performing basic numeric - * operations such as the elementary exponential, logarithm, square root, - * and trigonometric functions. - */ -@deprecated("use the scala.math package object instead.\n(Example package object usage: scala.math.Pi )", "2.8.0") -object Math extends MathCommon { - @deprecated("Use `scala.Byte.MinValue` instead", "2.8.0") - val MIN_BYTE = java.lang.Byte.MIN_VALUE - - @deprecated("Use `scala.Byte.MaxValue` instead", "2.8.0") - val MAX_BYTE = java.lang.Byte.MAX_VALUE - - @deprecated("Use `scala.Short.MinValue` instead", "2.8.0") - val MIN_SHORT = java.lang.Short.MIN_VALUE - - @deprecated("Use `scala.Short.MaxValue` instead", "2.8.0") - val MAX_SHORT = java.lang.Short.MAX_VALUE - - @deprecated("Use `scala.Char.MinValue` instead", "2.8.0") - val MIN_CHAR = java.lang.Character.MIN_VALUE - - @deprecated("Use `scala.Char.MaxValue` instead", "2.8.0") - val MAX_CHAR = java.lang.Character.MAX_VALUE - - @deprecated("Use `scala.Int.MinValue` instead", "2.8.0") - val MIN_INT = java.lang.Integer.MIN_VALUE - - @deprecated("Use `scala.Int.MaxValue` instead", "2.8.0") - val MAX_INT = java.lang.Integer.MAX_VALUE - - @deprecated("Use `scala.Long.MinValue` instead", "2.8.0") - val MIN_LONG = java.lang.Long.MIN_VALUE - - @deprecated("Use `scala.Long.MaxValue` instead", "2.8.0") - val MAX_LONG = java.lang.Long.MAX_VALUE - - /** The smallest possible value for [[scala.Float]]. */ - @deprecated("Use `scala.Float.MinValue` instead", "2.8.0") - val MIN_FLOAT = -java.lang.Float.MAX_VALUE - - /** The smallest difference between two values of [[scala.Float]]. */ - @deprecated("Use `scala.Float.MinPositiveValue` instead", "2.8.0") - val EPS_FLOAT = java.lang.Float.MIN_VALUE - - /** The greatest possible value for [[scala.Float]]. */ - @deprecated("Use `scala.Float.MaxValue` instead", "2.8.0") - val MAX_FLOAT = java.lang.Float.MAX_VALUE - - /** A value of type [[scala.Float]] that represents no number. */ - @deprecated("Use `scala.Float.NaN` instead", "2.8.0") - val NaN_FLOAT = java.lang.Float.NaN - - /** Negative infinity of type [[scala.Float]]. */ - @deprecated("Use `scala.Float.NegativeInfinity` instead", "2.8.0") - val NEG_INF_FLOAT = java.lang.Float.NEGATIVE_INFINITY - - /** Positive infinity of type [[scala.Float]]. */ - @deprecated("Use `scala.Float.PositiveInfinity` instead", "2.8.0") - val POS_INF_FLOAT = java.lang.Float.POSITIVE_INFINITY - - /** The smallest possible value for [[scala.Double]]. */ - @deprecated("Use `scala.Double.MinValue` instead", "2.8.0") - val MIN_DOUBLE = -java.lang.Double.MAX_VALUE - - /** The smallest difference between two values of [[scala.Double]]. */ - @deprecated("Use `scala.Double.MinPositiveValue` instead", "2.8.0") - val EPS_DOUBLE = java.lang.Double.MIN_VALUE - - /** The greatest possible value for [[scala.Double]]. */ - @deprecated("Use `scala.Double.MaxValue` instead", "2.8.0") - val MAX_DOUBLE = java.lang.Double.MAX_VALUE - - /** A value of type [[scala.Double]] that represents no number. */ - @deprecated("Use `scala.Double.NaN` instead", "2.8.0") - val NaN_DOUBLE = java.lang.Double.NaN - - /** Negative infinity of type [[scala.Double]]. */ - @deprecated("Use `scala.Double.NegativeInfinity` instead", "2.8.0") - val NEG_INF_DOUBLE = java.lang.Double.NEGATIVE_INFINITY - - /** Positive infinity of type [[scala.Double]]. */ - @deprecated("Use `scala.Double.PositiveInfinity` instead", "2.8.0") - val POS_INF_DOUBLE = java.lang.Double.POSITIVE_INFINITY -} diff --git a/src/library/scala/MathCommon.scala b/src/library/scala/MathCommon.scala deleted file mode 100644 index b7b54d50fa..0000000000 --- a/src/library/scala/MathCommon.scala +++ /dev/null @@ -1,139 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - -package scala - -/** Common code between the deprecated `scala.Math` object and - * the `scala.math` package object. - */ -private[scala] class MathCommon { - /** The `double` value that is closer than any other to `e`, the base of - * the natural logarithms. - */ - val E = java.lang.Math.E - - /** The `double` value that is closer than any other to `pi`, the ratio of - * the circumference of a circle to its diameter. - */ - val Pi = java.lang.Math.PI - - /** Returns a `double` value with a positive sign, greater than or equal - * to `0.0` and less than `1.0`. - */ - def random: Double = java.lang.Math.random() - - def sin(x: Double): Double = java.lang.Math.sin(x) - def cos(x: Double): Double = java.lang.Math.cos(x) - def tan(x: Double): Double = java.lang.Math.tan(x) - def asin(x: Double): Double = java.lang.Math.asin(x) - def acos(x: Double): Double = java.lang.Math.acos(x) - def atan(x: Double): Double = java.lang.Math.atan(x) - - /** Converts an angle measured in degrees to an approximately equivalent - * angle measured in radians. - * - * @param x an angle, in degrees - * @return the measurement of the angle `x` in radians. - */ - def toRadians(x: Double): Double = java.lang.Math.toRadians(x) - - /** Converts an angle measured in radians to an approximately equivalent - * angle measured in degrees. - * - * @param x angle, in radians - * @return the measurement of the angle `x` in degrees. - */ - def toDegrees(x: Double): Double = java.lang.Math.toDegrees(x) - - /** Returns Euler's number `e` raised to the power of a `double` value. - * - * @param x the exponent to raise `e` to. - * @return the value `e^a^`, where `e` is the base of the natural - * logarithms. - */ - def exp(x: Double): Double = java.lang.Math.exp(x) - def log(x: Double): Double = java.lang.Math.log(x) - def sqrt(x: Double): Double = java.lang.Math.sqrt(x) - def IEEEremainder(x: Double, y: Double): Double = java.lang.Math.IEEEremainder(x, y) - - def ceil(x: Double): Double = java.lang.Math.ceil(x) - def floor(x: Double): Double = java.lang.Math.floor(x) - - /** Returns the `double` value that is closest in value to the - * argument and is equal to a mathematical integer. - * - * @param x a `double` value - * @return the closest floating-point value to a that is equal to a - * mathematical integer. - */ - def rint(x: Double): Double = java.lang.Math.rint(x) - - /** Converts rectangular coordinates `(x, y)` to polar `(r, theta)`. - * - * @param x the ordinate coordinate - * @param y the abscissa coordinate - * @return the ''theta'' component of the point `(r, theta)` in polar - * coordinates that corresponds to the point `(x, y)` in - * Cartesian coordinates. - */ - def atan2(y: Double, x: Double): Double = java.lang.Math.atan2(y, x) - - /** Returns the value of the first argument raised to the power of the - * second argument. - * - * @param x the base. - * @param y the exponent. - * @return the value `x^y^`. - */ - def pow(x: Double, y: Double): Double = java.lang.Math.pow(x, y) - - /** Returns the closest `long` to the argument. - * - * @param x a floating-point value to be rounded to a `long`. - * @return the value of the argument rounded to the nearest`long` value. - */ - def round(x: Float): Int = java.lang.Math.round(x) - def round(x: Double): Long = java.lang.Math.round(x) - def abs(x: Int): Int = java.lang.Math.abs(x) - def abs(x: Long): Long = java.lang.Math.abs(x) - def abs(x: Float): Float = java.lang.Math.abs(x) - def abs(x: Double): Double = java.lang.Math.abs(x) - - def max(x: Int, y: Int): Int = java.lang.Math.max(x, y) - def max(x: Long, y: Long): Long = java.lang.Math.max(x, y) - def max(x: Float, y: Float): Float = java.lang.Math.max(x, y) - def max(x: Double, y: Double): Double = java.lang.Math.max(x, y) - - def min(x: Int, y: Int): Int = java.lang.Math.min(x, y) - def min(x: Long, y: Long): Long = java.lang.Math.min(x, y) - def min(x: Float, y: Float): Float = java.lang.Math.min(x, y) - def min(x: Double, y: Double): Double = java.lang.Math.min(x, y) - - def signum(x: Double): Double = - if (x == 0d) 0d - else if (x < 0) -1.0 - else if (x > 0) 1.0 - else x // NaN - - def signum(x: Float): Float = - if (x == 0f) 0f - else if (x < 0) -1.0f - else if (x > 0) 1.0f - else x // NaN - - def signum(x: Long): Long = - if (x == 0l) 0l - else if (x < 0) -1l - else 1l - - def signum(x: Int): Int = - if (x == 0) 0 - else if (x < 0) -1 - else 1 -} diff --git a/src/library/scala/NotDefinedError.scala b/src/library/scala/NotDefinedError.scala deleted file mode 100644 index 1fd0e7ec49..0000000000 --- a/src/library/scala/NotDefinedError.scala +++ /dev/null @@ -1,17 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - - -package scala - -/** - * @since 2.0 - */ -@deprecated("Use a custom Error class instead", "2.8.0") -final class NotDefinedError(msg: String) extends Error("not defined: " + msg) diff --git a/src/library/scala/Product.scala b/src/library/scala/Product.scala index cb316f2da3..53a838ee9d 100644 --- a/src/library/scala/Product.scala +++ b/src/library/scala/Product.scala @@ -42,9 +42,6 @@ trait Product extends Equals { def next() = { val result = productElement(c); c += 1; result } } - @deprecated("use productIterator instead", "2.8.0") - def productElements: Iterator[Any] = productIterator - /** A string used in the `toString` methods of derived classes. * Implementations may override this method to prepend a string prefix * to the result of `toString` methods. diff --git a/src/library/scala/UninitializedFieldError.scala b/src/library/scala/UninitializedFieldError.scala index 476485d798..a6e510a849 100644 --- a/src/library/scala/UninitializedFieldError.scala +++ b/src/library/scala/UninitializedFieldError.scala @@ -13,11 +13,8 @@ package scala /** This class implements errors which are thrown whenever a * field is used before it has been initialized. * - * Such runtime checks are not emitted by default. See the - * compiler documentation for knowing how to turn them on. - * - * Note: This check requires the initialization order - * first implemented in scala 2.8. + * Such runtime checks are not emitted by default. + * They can be enabled by the `-Xcheckinit` compiler option. * * @since 2.7 */ diff --git a/src/library/scala/collection/Iterable.scala b/src/library/scala/collection/Iterable.scala index 0381da0841..0717861c26 100644 --- a/src/library/scala/collection/Iterable.scala +++ b/src/library/scala/collection/Iterable.scala @@ -48,15 +48,4 @@ object Iterable extends TraversableFactory[Iterable] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Iterable[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]] def newBuilder[A]: Builder[A, Iterable[A]] = immutable.Iterable.newBuilder[A] - - /** The minimum element of a non-empty sequence of ordered elements */ - @deprecated("use <seq>.min instead, where <seq> is the sequence for which you want to compute the minimum", "2.8.0") - def min[A](seq: Iterable[A])(implicit ord: Ordering[A]): A = seq.min - - /** The maximum element of a non-empty sequence of ordered elements */ - @deprecated("use <seq>.max instead, where <seq> is the sequence for which you want to compute the maximum", "2.8.0") - def max[A](seq: Iterable[A])(implicit ord: Ordering[A]): A = seq.max - - @deprecated("use View instead", "2.8.0") - type Projection[A] = IterableView[A, Coll] } diff --git a/src/library/scala/collection/IterableLike.scala b/src/library/scala/collection/IterableLike.scala index 3e63800f2d..e5aa381c9f 100644 --- a/src/library/scala/collection/IterableLike.scala +++ b/src/library/scala/collection/IterableLike.scala @@ -298,23 +298,4 @@ self => } override /*TraversableLike*/ def view(from: Int, until: Int) = view.slice(from, until) - - @deprecated("use `iterator` instead", "2.8.0") - def elements = iterator - - @deprecated("use `head` instead", "2.8.0") - def first: A = head - - /** `None` if iterable is empty. - */ - @deprecated("use `headOption` instead", "2.8.0") - def firstOption: Option[A] = headOption - - /** - * returns a projection that can be used to call non-strict `filter`, - * `map`, and `flatMap` methods that build projections - * of the collection. - */ - @deprecated("use `view` instead", "2.8.0") - def projection = view } diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala index 705ef4e0ed..fabb106f3e 100644 --- a/src/library/scala/collection/Iterator.scala +++ b/src/library/scala/collection/Iterator.scala @@ -149,86 +149,6 @@ object Iterator { def hasNext = true def next = elem } - - @deprecated("use `xs.iterator` or `Iterator(xs)` instead", "2.8.0") - def fromValues[a](xs: a*) = xs.iterator - - /** @param xs the array of elements - * @see also: IndexedSeq.iterator and slice - */ - @deprecated("use `xs.iterator` instead", "2.8.0") - def fromArray[a](xs: Array[a]): Iterator[a] = - fromArray(xs, 0, xs.length) - - /** - * @param xs the array of elements - * @param start the start index - * @param length the length - * @see also: IndexedSeq.iterator and slice - */ - @deprecated("use `xs.slice(start, start + length).iterator` instead", "2.8.0") - def fromArray[a](xs: Array[a], start: Int, length: Int): Iterator[a] = - xs.slice(start, start + length).iterator - - /** - * @param n the product arity - * @return the iterator on `Product<n>`. - */ - @deprecated("use `product.productIterator instead`", "2.8.0") - def fromProduct(n: Product): Iterator[Any] = new Iterator[Any] { - private var c: Int = 0 - private val cmax = n.productArity - def hasNext = c < cmax - def next() = { val a = n productElement c; c += 1; a } - } - - /** Create an iterator with elements `e<sub>n+1</sub> = step(e<sub>n</sub>)` where `e<sub>0</sub> = start` - * and elements are in the range between `start` (inclusive) and `end` (exclusive). - * - * @param start the start value of the iterator - * @param end the end value of the iterator - * @param step the increment function of the iterator, must be monotonically increasing or decreasing - * @return the iterator with values in range `[start;end)`. - */ - @deprecated("use `Iterator.iterate(start, end - start)(step)` instead", "2.8.0") - def range(start: Int, end: Int, step: Int => Int) = new Iterator[Int] { - private val up = step(start) > start - private val down = step(start) < start - private var i = start - def hasNext: Boolean = (!up || i < end) && (!down || i > end) - def next(): Int = - if (hasNext) { val j = i; i = step(i); j } - else empty.next() - } - - /** Create an iterator with elements `e<sub>n+1</sub> = step(e<sub>n</sub>)` where `e<sub>0</sub> = start`. - * - * @param start the start value of the iterator - * @param step the increment function of the iterator - * @return the iterator starting at value `start`. - */ - @deprecated("use `iterate(start)(step)` instead", "2.8.0") - def from(start: Int, step: Int => Int): Iterator[Int] = new Iterator[Int] { - private var i = start - override def hasNext: Boolean = true - def next(): Int = { val j = i; i = step(i); j } - } - - /** Create an iterator that is the concatenation of all iterators returned by a given iterator of iterators. - * - * @param its The iterator which returns on each call to next - * a new iterator whose elements are to be concatenated to the result. - */ - @deprecated("use `its.flatten` instead", "2.8.0") - def flatten[T](its: Iterator[Iterator[T]]): Iterator[T] = new Iterator[T] { - private var cur = its.next - def hasNext: Boolean = { - while (!cur.hasNext && its.hasNext) cur = its.next - cur.hasNext - } - def next(): T = - (if (hasNext) cur else empty).next() - } } import Iterator.empty @@ -1030,52 +950,4 @@ trait Iterator[+A] extends TraversableOnce[A] { * whether or not the iterator is empty. */ override def toString = (if (hasNext) "non-empty" else "empty")+" iterator" - - /** Returns a new iterator that first yields the elements of this - * iterator followed by the elements provided by iterator `that`. - */ - @deprecated("use `++`", "2.3.2") - def append[B >: A](that: Iterator[B]) = self ++ that - - /** Returns index of the first element satisfying a predicate, or -1. */ - @deprecated("use `indexWhere` instead", "2.8.0") - def findIndexOf(p: A => Boolean): Int = indexWhere(p) - - /** Returns a counted iterator from this iterator. - */ - @deprecated("use `zipWithIndex` in `Iterator`", "2.8.0") - def counted = new CountedIterator[A] { - private var cnt = 0 - def count = cnt - def hasNext: Boolean = self.hasNext - def next(): A = { cnt += 1; self.next } - } - - /** Fills the given array `xs` with the elements of - * this sequence starting at position `start`. Like `copyToArray`, - * but designed to accomodate IO stream operations. - * - * '''Note:''' the array must be large enough to hold `sz` elements. - * @param xs the array to fill. - * @param start the starting index. - * @param sz the maximum number of elements to be read. - */ - @deprecated("use `copyToArray` instead", "2.8.0") - def readInto[B >: A](xs: Array[B], start: Int, sz: Int) { - var i = start - while (hasNext && i - start < sz) { - xs(i) = next - i += 1 - } - } - - @deprecated("use `copyToArray` instead", "2.8.0") - def readInto[B >: A](xs: Array[B], start: Int) { - readInto(xs, start, xs.length - start) - } - - @deprecated("use copyToArray instead", "2.8.0") - def readInto[B >: A](xs: Array[B]) { - readInto(xs, 0, xs.length) - } } diff --git a/src/library/scala/collection/JavaConversions.scala b/src/library/scala/collection/JavaConversions.scala index 39b86ad85d..ea3c911169 100644 --- a/src/library/scala/collection/JavaConversions.scala +++ b/src/library/scala/collection/JavaConversions.scala @@ -73,9 +73,6 @@ object JavaConversions { case _ => IteratorWrapper(i) } - @deprecated("use asJavaIterator instead", "2.8.1") - def asIterator[A](i : Iterator[A]): ju.Iterator[A] = asJavaIterator[A](i) - /** * Implicitly converts a Scala Iterator to a Java Enumeration. * The returned Java Enumeration is backed by the provided Scala @@ -94,9 +91,6 @@ object JavaConversions { case _ => IteratorWrapper(i) } - @deprecated("use asJavaEnmeration instead", "2.8.1") - def asEnumeration[A](i : Iterator[A]): ju.Enumeration[A] = asJavaEnumeration[A](i) - /** * Implicitly converts a Scala Iterable to a Java Iterable. * The returned Java Iterable is backed by the provided Scala @@ -115,9 +109,6 @@ object JavaConversions { case _ => IterableWrapper(i) } - @deprecated("use asJavaIterable instead", "2.8.1") - def asIterable[A](i : Iterable[A]): jl.Iterable[A] = asJavaIterable[A](i) - /** * Implicitly converts a Scala Iterable to an immutable Java * Collection. @@ -134,9 +125,6 @@ object JavaConversions { case _ => new IterableWrapper(i) } - @deprecated("use asJavaCollection instead", "2.8.1") - def asCollection[A](i : Iterable[A]): ju.Collection[A] = asJavaCollection[A](i) - /** * Implicitly converts a Scala mutable Buffer to a Java List. * The returned Java List is backed by the provided Scala @@ -156,8 +144,6 @@ object JavaConversions { } @deprecated("use bufferAsJavaList instead", "2.9.0") def asJavaList[A](b : mutable.Buffer[A]): ju.List[A] = bufferAsJavaList[A](b) - @deprecated("use bufferAsJavaList instead", "2.8.1") - def asList[A](b : mutable.Buffer[A]): ju.List[A] = bufferAsJavaList[A](b) /** * Implicitly converts a Scala mutable Seq to a Java List. @@ -178,8 +164,6 @@ object JavaConversions { } @deprecated("use mutableSeqAsJavaList instead", "2.9.0") def asJavaList[A](b : mutable.Seq[A]): ju.List[A] = mutableSeqAsJavaList[A](b) - @deprecated("use mutableSeqAsJavaList instead", "2.8.1") - def asList[A](b : mutable.Seq[A]): ju.List[A] = mutableSeqAsJavaList[A](b) /** * Implicitly converts a Scala Seq to a Java List. @@ -201,8 +185,6 @@ object JavaConversions { @deprecated("use seqAsJavaList instead", "2.9.0") def asJavaList[A](b : Seq[A]): ju.List[A] = seqAsJavaList[A](b) - @deprecated("use seqAsJavaList instead", "2.8.1") - def asList[A](b : Seq[A]): ju.List[A] = seqAsJavaList[A](b) /** * Implicitly converts a Scala mutable Set to a Java Set. @@ -224,8 +206,6 @@ object JavaConversions { @deprecated("use mutableSetAsJavaSet instead", "2.9.0") def asJavaSet[A](s : mutable.Set[A]): ju.Set[A] = mutableSetAsJavaSet[A](s) - @deprecated("use mutableSetAsJavaSet instead", "2.8.1") - def asSet[A](s : mutable.Set[A]): ju.Set[A] = mutableSetAsJavaSet[A](s) /** * Implicitly converts a Scala Set to a Java Set. @@ -247,8 +227,6 @@ object JavaConversions { @deprecated("use setAsJavaSet instead", "2.9.0") def asJavaSet[A](s: Set[A]): ju.Set[A] = setAsJavaSet[A](s) - @deprecated("use setAsJavaSet instead", "2.8.1") - def asSet[A](s : Set[A]): ju.Set[A] = setAsJavaSet[A](s) /** * Implicitly converts a Scala mutable Map to a Java Map. @@ -271,8 +249,6 @@ object JavaConversions { @deprecated("use mutableMapAsJavaMap instead", "2.9.0") def asJavaMap[A, B](m : mutable.Map[A, B]): ju.Map[A, B] = mutableMapAsJavaMap[A, B](m) - @deprecated("use mutableMapAsJavaMap instead", "2.8.1") - def asMap[A, B](m : mutable.Map[A, B]): ju.Map[A, B] = mutableMapAsJavaMap[A, B](m) /** * Implicitly converts a Scala mutable `Map` to a Java `Dictionary`. @@ -294,9 +270,6 @@ object JavaConversions { case _ => new DictionaryWrapper(m) } - @deprecated("use asJavaDictionary instead", "2.8.1") - def asDictionary[A, B](m : mutable.Map[A, B]): ju.Dictionary[A, B] = asJavaDictionary[A, B](m) - /** * Implicitly converts a Scala `Map` to a Java `Map`. * @@ -319,8 +292,6 @@ object JavaConversions { @deprecated("use mapAsJavaMap instead", "2.9.0") def asJavaMap[A, B](m : Map[A, B]): ju.Map[A, B] = mapAsJavaMap[A, B](m) - @deprecated("use mapAsJavaMap instead", "2.8.1") - def asMap[A, B](m : Map[A, B]): ju.Map[A, B] = mapAsJavaMap[A, B](m) /** * Implicitly converts a Scala mutable `ConcurrentMap` to a Java @@ -342,9 +313,6 @@ object JavaConversions { case _ => new ConcurrentMapWrapper(m) } - @deprecated("use asJavaConcurrentMap instead", "2.8.1") - def asConcurrentMap[A, B](m: mutable.ConcurrentMap[A, B]): juc.ConcurrentMap[A, B] = asJavaConcurrentMap[A, B](m) - // Java => Scala /** @@ -366,9 +334,6 @@ object JavaConversions { case _ => JIteratorWrapper(i) } - @deprecated("use asScalaIterator instead", "2.8.1") - def asIterator[A](i : ju.Iterator[A]): Iterator[A] = asScalaIterator[A](i) - /** * Implicitly converts a Java Enumeration to a Scala Iterator. * The returned Scala Iterator is backed by the provided Java @@ -387,9 +352,6 @@ object JavaConversions { case _ => JEnumerationWrapper(i) } - @deprecated("use enumerationAsScalaIterator instead", "2.8.1") - def asIterator[A](i : ju.Enumeration[A]): Iterator[A] = enumerationAsScalaIterator[A](i) - /** * Implicitly converts a Java `Iterable` to a Scala `Iterable`. * @@ -411,8 +373,6 @@ object JavaConversions { @deprecated("use iterableAsScalaIterable instead", "2.9.0") def asScalaIterable[A](i : jl.Iterable[A]): Iterable[A] = iterableAsScalaIterable[A](i) - @deprecated("use iterableAsScalaIterable instead", "2.8.1") - def asIterable[A](i : jl.Iterable[A]): Iterable[A] = iterableAsScalaIterable[A](i) /** * Implicitly converts a Java `Collection` to an Scala `Iterable`. @@ -430,8 +390,6 @@ object JavaConversions { } @deprecated("use collectionAsScalaIterable instead", "2.9.0") def asScalaIterable[A](i : ju.Collection[A]): Iterable[A] = collectionAsScalaIterable[A](i) - @deprecated("use collectionAsScalaIterable instead", "2.8.1") - def asIterable[A](i : ju.Collection[A]): Iterable[A] = collectionAsScalaIterable[A](i) /** * Implicitly converts a Java `List` to a Scala mutable `Buffer`. @@ -452,9 +410,6 @@ object JavaConversions { case _ =>new JListWrapper(l) } - @deprecated("use asScalaBuffer instead", "2.8.1") - def asBuffer[A](l : ju.List[A]): mutable.Buffer[A] = asScalaBuffer[A](l) - /** * Implicitly converts a Java Set to a Scala mutable Set. * The returned Scala Set is backed by the provided Java @@ -473,9 +428,6 @@ object JavaConversions { case _ =>new JSetWrapper(s) } - @deprecated("use asScalaSet instead", "2.8.1") - def asSet[A](s : ju.Set[A]): mutable.Set[A] = asScalaSet[A](s) - /** * Implicitly converts a Java `Map` to a Scala mutable `Map`. * @@ -498,8 +450,6 @@ object JavaConversions { @deprecated("use mapAsScalaMap instead", "2.9.0") def asScalaMap[A, B](m : ju.Map[A, B]): mutable.Map[A, B] = mapAsScalaMap[A, B](m) - @deprecated("use mapAsScalaMap instead", "2.8.1") - def asMap[A, B](m : ju.Map[A, B]): mutable.Map[A, B] = mapAsScalaMap[A, B](m) /** * Implicitly converts a Java ConcurrentMap to a Scala mutable ConcurrentMap. @@ -519,9 +469,6 @@ object JavaConversions { case _ => new JConcurrentMapWrapper(m) } - @deprecated("use asScalaConcurrentMap instead", "2.8.1") - def asConcurrentMap[A, B](m: juc.ConcurrentMap[A, B]): mutable.ConcurrentMap[A, B] = asScalaConcurrentMap[A, B](m) - /** * Implicitly converts a Java `Dictionary` to a Scala mutable * `Map[String, String]`. @@ -538,9 +485,6 @@ object JavaConversions { case _ => new JDictionaryWrapper(p) } - @deprecated("use dictionaryAsScalaMap instead", "2.8.1") - def asMap[A, B](p: ju.Dictionary[A, B]): mutable.Map[A, B] = dictionaryAsScalaMap[A, B](p) - /** * Implicitly converts a Java `Properties` to a Scala `mutable Map[String, String]`. * @@ -557,8 +501,6 @@ object JavaConversions { @deprecated("use propertiesAsScalaMap instead", "2.9.0") def asScalaMap(p: ju.Properties): mutable.Map[String, String] = propertiesAsScalaMap(p) - @deprecated("use propertiesAsScalaMap instead", "2.8.1") - def asMap(p: ju.Properties): mutable.Map[String, String] = propertiesAsScalaMap(p) // Private implementations (shared by JavaConverters) ... diff --git a/src/library/scala/collection/MapLike.scala b/src/library/scala/collection/MapLike.scala index 4ffcc111cc..5b4ac20329 100644 --- a/src/library/scala/collection/MapLike.scala +++ b/src/library/scala/collection/MapLike.scala @@ -246,9 +246,6 @@ self => def get(key: A) = self.get(key).map(f) } - @deprecated("use `mapValues` instead", "2.8.0") - def mapElements[C](f: B => C) = mapValues(f) - // The following 5 operations (updated, two times +, two times ++) should really be // generic, returning This[B]. We need better covariance support to express that though. // So right now we do the brute force approach of code duplication. diff --git a/src/library/scala/collection/Seq.scala b/src/library/scala/collection/Seq.scala index 2fbbaee355..04d513b7e4 100644 --- a/src/library/scala/collection/Seq.scala +++ b/src/library/scala/collection/Seq.scala @@ -39,11 +39,5 @@ object Seq extends SeqFactory[Seq] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Seq[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]] def newBuilder[A]: Builder[A, Seq[A]] = immutable.Seq.newBuilder[A] - - @deprecated("use View instead", "2.8.0") - type Projection[A] = SeqView[A, Coll] - - @deprecated("use Seq(value) instead", "2.8.0") - def singleton[A](value: A) = Seq(value) } diff --git a/src/library/scala/collection/SeqLike.scala b/src/library/scala/collection/SeqLike.scala index 684aaac214..3d7b0064d9 100644 --- a/src/library/scala/collection/SeqLike.scala +++ b/src/library/scala/collection/SeqLike.scala @@ -118,11 +118,6 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] with GenSeqLike[A, Repr] -1 } - /** Returns index of the first element satisfying a predicate, or `-1`. - */ - @deprecated("Use indexWhere(p) instead.", "2.8.0") - def findIndexOf(p: A => Boolean): Int = indexWhere(p) - def lastIndexWhere(p: A => Boolean, end: Int): Int = { var i = length - 1 val it = reverseIterator @@ -290,9 +285,6 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] with GenSeqLike[A, Repr] */ def reverseIterator: Iterator[A] = toCollection(reverse).iterator - @deprecated("use `reverseIterator` instead", "2.8.0") - def reversedElements = reverseIterator - def startsWith[B](that: GenSeq[B], offset: Int): Boolean = { val i = this.iterator drop offset val j = that.iterator @@ -678,31 +670,6 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] with GenSeqLike[A, Repr] /* Need to override string, so that it's not the Function1's string that gets mixed in. */ override def toString = super[IterableLike].toString - - /** Returns index of the last element satisfying a predicate, or -1. - */ - @deprecated("use `lastIndexWhere` instead", "2.8.0") - def findLastIndexOf(p: A => Boolean): Int = lastIndexWhere(p) - - /** Tests whether every element of this $coll relates to the - * corresponding element of another sequence by satisfying a test predicate. - * - * @param that the other sequence - * @param p the test predicate, which relates elements from both sequences - * @tparam B the type of the elements of `that` - * @return `true` if both sequences have the same length and - * `p(x, y)` is `true` for all corresponding elements `x` of this $coll - * and `y` of `that`, otherwise `false`. - */ - @deprecated("use `corresponds` instead", "2.8.0") - def equalsWith[B](that: Seq[B])(f: (A,B) => Boolean): Boolean = corresponds(that)(f) - - /** - * returns a projection that can be used to call non-strict `filter`, - * `map`, and `flatMap` methods that build projections of the collection. - */ - @deprecated("use `view` instead", "2.8.0") - override def projection = view } /** The companion object for trait `SeqLike`. diff --git a/src/library/scala/collection/SeqProxyLike.scala b/src/library/scala/collection/SeqProxyLike.scala index 565bd9ff5e..ce32ba97c2 100644 --- a/src/library/scala/collection/SeqProxyLike.scala +++ b/src/library/scala/collection/SeqProxyLike.scala @@ -33,7 +33,6 @@ trait SeqProxyLike[+A, +Repr <: SeqLike[A, Repr] with Seq[A]] extends SeqLike[A, override def prefixLength(p: A => Boolean) = self.prefixLength(p) override def indexWhere(p: A => Boolean): Int = self.indexWhere(p) override def indexWhere(p: A => Boolean, from: Int): Int = self.indexWhere(p, from) - override def findIndexOf(p: A => Boolean): Int = self.indexWhere(p) override def indexOf[B >: A](elem: B): Int = self.indexOf(elem) override def indexOf[B >: A](elem: B, from: Int): Int = self.indexOf(elem, from) override def lastIndexOf[B >: A](elem: B): Int = self.lastIndexOf(elem) diff --git a/src/library/scala/collection/SetLike.scala b/src/library/scala/collection/SetLike.scala index 395e253430..fecbaa61f2 100644 --- a/src/library/scala/collection/SetLike.scala +++ b/src/library/scala/collection/SetLike.scala @@ -144,15 +144,6 @@ self => */ override def isEmpty: Boolean = size == 0 - /** This method is an alias for `intersect`. - * It computes an intersection with set `that`. - * It removes all the elements that are not present in `that`. - * - * @param that the set to intersect with - */ - @deprecated("use & instead", "2.8.0") - def ** (that: Set[A]): This = &(that) - /** Computes the union between of set and another set. * * @param that the set to form the union with. diff --git a/src/library/scala/collection/TraversableView.scala b/src/library/scala/collection/TraversableView.scala index 99d3551275..67886eb3b4 100644 --- a/src/library/scala/collection/TraversableView.scala +++ b/src/library/scala/collection/TraversableView.scala @@ -24,8 +24,6 @@ object TraversableView { class NoBuilder[A] extends Builder[A, Nothing] { def +=(elem: A): this.type = this def iterator: Iterator[A] = Iterator.empty - @deprecated("use `iterator` instead", "2.8.0") - def elements = iterator def result() = throw new UnsupportedOperationException("TraversableView.Builder.result") def clear() {} } diff --git a/src/library/scala/collection/generic/Addable.scala b/src/library/scala/collection/generic/Addable.scala deleted file mode 100644 index e2a34c1ed2..0000000000 --- a/src/library/scala/collection/generic/Addable.scala +++ /dev/null @@ -1,61 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - -package scala.collection -package generic - -import annotation.bridge - -/** This trait represents collection-like objects that can be added to - * using a '+' operator. It defines variants of `+` and `++` - * as convenience methods in terms of single-element addition `+`. - * @tparam A the type of the elements of the $coll - * @tparam Repr the type of the $coll itself - * @author Martin Odersky - * @version 2.8 - * @since 2.8 - * @define coll collection - * @define Coll Addable - */ -@deprecated("Will be removed after scala 2.9", "2.8.0") -trait Addable[A, +Repr <: Addable[A, Repr]] { self => - - /** The representation object of type `Repr` which contains the collection's elements - */ - protected def repr: Repr - - /** Creates a new $coll with an additional element, unless the element is already present. - * @param elem the element to add - * @return a fresh collection with `elem` added. - */ - def +(elem: A): Repr - - /** Creates a new $coll with additional elements. - * - * This method takes two or more elements to be added. Another overloaded - * variant of this method handles the case where a single element is - * added. - * @param elem1 the first element to add. - * @param elem2 the second element to add. - * @param elems the remaining elements to add. - * @return a new $coll with the given elements added. - */ - def + (elem1: A, elem2: A, elems: A*): Repr = - this + elem1 + elem2 ++ elems - - /** Creates a new $coll by adding all elements contained in another collection to this $coll. - * - * @param elems the collection containing the added elements. - * @return a new $coll with the given elements added. - */ - def ++ (xs: GenTraversableOnce[A]): Repr = (repr /: xs.seq) (_ + _) - - @bridge - def ++ (xs: TraversableOnce[A]): Repr = ++ (xs: GenTraversableOnce[A]) -} diff --git a/src/library/scala/collection/generic/SeqForwarder.scala b/src/library/scala/collection/generic/SeqForwarder.scala index eb8e0b3ee9..10e8c37cbf 100644 --- a/src/library/scala/collection/generic/SeqForwarder.scala +++ b/src/library/scala/collection/generic/SeqForwarder.scala @@ -35,7 +35,6 @@ trait SeqForwarder[+A] extends Seq[A] with IterableForwarder[A] { override def prefixLength(p: A => Boolean) = underlying prefixLength p override def indexWhere(p: A => Boolean): Int = underlying indexWhere p override def indexWhere(p: A => Boolean, from: Int): Int = underlying.indexWhere(p, from) - override def findIndexOf(p: A => Boolean): Int = underlying indexWhere p override def indexOf[B >: A](elem: B): Int = underlying indexOf elem override def indexOf[B >: A](elem: B, from: Int): Int = underlying.indexOf(elem, from) override def lastIndexOf[B >: A](elem: B): Int = underlying lastIndexOf elem diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index 8f7d92f9e5..5791e9788d 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -245,114 +245,6 @@ sealed abstract class List[+A] extends LinearSeq[A] override def toStream : Stream[A] = if (isEmpty) Stream.Empty else new Stream.Cons(head, tail.toStream) - - /** Like `span` but with the predicate inverted. - */ - @deprecated("use `span { x => !p(x) }` instead", "2.8.0") - def break(p: A => Boolean): (List[A], List[A]) = span { x => !p(x) } - - @deprecated("use `filterNot` instead", "2.8.0") - def remove(p: A => Boolean): List[A] = filterNot(p) - - /** Computes the difference between this list and the given list `that`. - * - * @param that the list of elements to remove from this list. - * @return this list without the elements of the given list `that`. - */ - @deprecated("use `list1 filterNot (list2 contains)` instead", "2.8.0") - def -- [B >: A](that: List[B]): List[B] = { - val b = new ListBuffer[B] - var these = this - while (!these.isEmpty) { - if (!that.contains(these.head)) b += these.head - these = these.tail - } - b.toList - } - - /** Computes the difference between this list and the given object `x`. - * - * @param x the object to remove from this list. - * @return this list without occurrences of the given object - * `x`. - */ - @deprecated("use `filterNot (_ == x)` instead", "2.8.0") - def - [B >: A](x: B): List[B] = { - val b = new ListBuffer[B] - var these = this - while (!these.isEmpty) { - if (these.head != x) b += these.head - these = these.tail - } - b.toList - } - - @deprecated("use `distinct` instead", "2.8.0") - def removeDuplicates: List[A] = distinct - - @deprecated("use `sortWith` instead", "2.8.0") - def sort(lt : (A,A) => Boolean): List[A] = { - /** Merge two already-sorted lists */ - def merge(l1: List[A], l2: List[A]): List[A] = { - val res = new ListBuffer[A] - var left1 = l1 - var left2 = l2 - - while (!left1.isEmpty && !left2.isEmpty) { - if(lt(left1.head, left2.head)) { - res += left1.head - left1 = left1.tail - } else { - res += left2.head - left2 = left2.tail - } - } - - res ++= left1 - res ++= left2 - - res.toList - } - - /** Split a list `lst` into two lists of about the same size */ - def split(lst: List[A]) = { - val res1 = new ListBuffer[A] - val res2 = new ListBuffer[A] - var left = lst - - while (!left.isEmpty) { - res1 += left.head - left = left.tail - if (!left.isEmpty) { - res2 += left.head - left = left.tail - } - } - - (res1.toList, res2.toList) - } - - /** Merge-sort the specified list */ - def ms(lst: List[A]): List[A] = - lst match { - case Nil => lst - case x :: Nil => lst - case x :: y :: Nil => - if (lt(x,y)) - lst - else - y :: x :: Nil - - case lst => - val (l1, l2) = split(lst) - val l1s = ms(l1) - val l2s = ms(l2) - merge(l1s, l2s) - } - - ms(this) - } - } /** The empty list. @@ -419,8 +311,6 @@ final case class ::[B](private var hd: B, private[scala] var tl: List[B]) extend */ object List extends SeqFactory[List] { - import scala.collection.{Iterable, Seq, IndexedSeq} - /** $genericCanBuildFromInfo */ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, List[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]] @@ -430,337 +320,6 @@ object List extends SeqFactory[List] { override def empty[A]: List[A] = Nil override def apply[A](xs: A*): List[A] = xs.toList - - /** Create a sorted list with element values `v,,>n+1,, = step(v,,n,,)` - * where `v,,0,, = start` and elements are in the range between `start` - * (inclusive) and `end` (exclusive). - * - * @param start the start value of the list - * @param end the end value of the list - * @param step the increment function of the list, which given `v,,n,,`, - * computes `v,,n+1,,`. Must be monotonically increasing - * or decreasing. - * @return the sorted list of all integers in range `[start;end)`. - */ - @deprecated("use `iterate` instead", "2.8.0") - def range(start: Int, end: Int, step: Int => Int): List[Int] = { - val up = step(start) > start - val down = step(start) < start - val b = new ListBuffer[Int] - var i = start - while ((!up || i < end) && (!down || i > end)) { - b += i - val next = step(i) - if (i == next) - throw new IllegalArgumentException("the step function did not make any progress on "+ i) - i = next - } - b.toList - } - - /** Create a list containing several copies of an element. - * - * @param n the length of the resulting list - * @param elem the element composing the resulting list - * @return a list composed of `n` elements all equal to `elem` - */ - @deprecated("use `fill` instead", "2.8.0") - def make[A](n: Int, elem: A): List[A] = { - val b = new ListBuffer[A] - var i = 0 - while (i < n) { - b += elem - i += 1 - } - b.toList - } - - /** Concatenate all the elements of a given list of lists. - * - * @param xss the list of lists that are to be concatenated - * @return the concatenation of all the lists - */ - @deprecated("use `xss.flatten` instead of `List.flatten(xss)`", "2.8.0") - def flatten[A](xss: List[List[A]]): List[A] = { - val b = new ListBuffer[A] - for (xs <- xss) { - var xc = xs - while (!xc.isEmpty) { - b += xc.head - xc = xc.tail - } - } - b.toList - } - - /** Transforms a list of pairs into a pair of lists. - * - * @param xs the list of pairs to unzip - * @return a pair of lists. - */ - @deprecated("use `xs.unzip` instead of `List.unzip(xs)`", "2.8.0") - def unzip[A,B](xs: List[(A,B)]): (List[A], List[B]) = { - val b1 = new ListBuffer[A] - val b2 = new ListBuffer[B] - var xc = xs - while (!xc.isEmpty) { - b1 += xc.head._1 - b2 += xc.head._2 - xc = xc.tail - } - (b1.toList, b2.toList) - } - - /** Transforms an iterable of pairs into a pair of lists. - * - * @param xs the iterable of pairs to unzip - * @return a pair of lists. - */ - @deprecated("use `xs.unzip` instead of `List.unzip(xs)`", "2.8.0") - def unzip[A,B](xs: Iterable[(A,B)]): (List[A], List[B]) = - xs.foldRight[(List[A], List[B])]((Nil, Nil)) { - case ((x, y), (xs, ys)) => (x :: xs, y :: ys) - } - - /** - * Returns the `Left` values in the given `Iterable` of `Either`s. - */ - @deprecated("use `xs collect { case Left(x: A) => x }` instead of `List.lefts(xs)`", "2.8.0") - def lefts[A, B](es: Iterable[Either[A, B]]) = - es.foldRight[List[A]](Nil)((e, as) => e match { - case Left(a) => a :: as - case Right(_) => as - }) - - /** - * Returns the `Right` values in the given `Iterable` of `Either`s. - */ - @deprecated("use `xs collect { case Right(x: B) => x }` instead of `List.rights(xs)`", "2.8.0") - def rights[A, B](es: Iterable[Either[A, B]]) = - es.foldRight[List[B]](Nil)((e, bs) => e match { - case Left(_) => bs - case Right(b) => b :: bs - }) - - /** Transforms an Iterable of Eithers into a pair of lists. - * - * @param xs the iterable of Eithers to separate - * @return a pair of lists. - */ - @deprecated("use `(for (Left(x) <- es) yield x, for (Right(x) <- es) yield x)` instead", "2.8.0") - def separate[A,B](es: Iterable[Either[A, B]]): (List[A], List[B]) = - es.foldRight[(List[A], List[B])]((Nil, Nil)) { - case (Left(a), (lefts, rights)) => (a :: lefts, rights) - case (Right(b), (lefts, rights)) => (lefts, b :: rights) - } - - /** Converts an iterator to a list. - * - * @param it the iterator to convert - * @return a list that contains the elements returned by successive - * calls to `it.next` - */ - @deprecated("use `it.toList` instead of `List.toList(it)`", "2.8.0") - def fromIterator[A](it: Iterator[A]): List[A] = it.toList - - /** Converts an array into a list. - * - * @param arr the array to convert - * @return a list that contains the same elements than `arr` - * in the same order - */ - @deprecated("use `array.toList` instead of `List.fromArray(array)`", "2.8.0") - def fromArray[A](arr: Array[A]): List[A] = fromArray(arr, 0, arr.length) - - /** Converts a range of an array into a list. - * - * @param arr the array to convert - * @param start the first index to consider - * @param len the length of the range to convert - * @return a list that contains the same elements than `arr` - * in the same order - */ - @deprecated("use `array.view(start, end).toList` instead of `List.fromArray(array, start, end)`", "2.8.0") - def fromArray[A](arr: Array[A], start: Int, len: Int): List[A] = { - var res: List[A] = Nil - var i = start + len - while (i > start) { - i -= 1 - res = arr(i) :: res - } - res - } - - /** Parses a string which contains substrings separated by a - * separator character and returns a list of all substrings. - * - * @param str the string to parse - * @param separator the separator character - * @return the list of substrings - */ - @deprecated("use `str.split(separator).toList` instead of `List.fromString(str, separator)`", "2.8.0") - def fromString(str: String, separator: Char): List[String] = { - var words: List[String] = Nil - var pos = str.length() - while (pos > 0) { - val pos1 = str.lastIndexOf(separator, pos - 1) - if (pos1 + 1 < pos) - words = str.substring(pos1 + 1, pos) :: words - pos = pos1 - } - words - } - - /** Returns the given list of characters as a string. - * - * @param xs the list to convert. - * @return the list in form of a string. - */ - @deprecated("use `xs.mkString` instead of `List.toString(xs)`", "2.8.0") - def toString(xs: List[Char]): String = { - val sb = new StringBuilder() - var xc = xs - while (!xc.isEmpty) { - sb.append(xc.head) - xc = xc.tail - } - sb.toString() - } - - /** Like xs map f, but returns `xs` unchanged if function - * `f` maps all elements to themselves. - */ - @deprecated("use `xs.mapConserve(f)` instead of `List.mapConserve(xs, f)`", "2.8.0") - def mapConserve[A <: AnyRef](xs: List[A])(f: A => A): List[A] = { - def loop(ys: List[A]): List[A] = - if (ys.isEmpty) xs - else { - val head0 = ys.head - val head1 = f(head0) - if (head1 eq head0) { - loop(ys.tail) - } else { - val ys1 = head1 :: mapConserve(ys.tail)(f) - if (xs eq ys) ys1 - else { - val b = new ListBuffer[A] - var xc = xs - while (xc ne ys) { - b += xc.head - xc = xc.tail - } - b.prependToList(ys1) - } - } - } - loop(xs) - } - - /** Returns the list resulting from applying the given function `f` - * to corresponding elements of the argument lists. - * - * @param f function to apply to each pair of elements. - * @return `[f(a,,0,,,b,,0,,), ..., f(a,,n,,,b,,n,,)]` if the lists are - * `[a,,0,,, ..., a,,k,,]`, `[b,,0,,, ..., b,,l,,]` and - * `n = min(k,l)` - */ - @deprecated("use `(xs, ys).zipped.map(f)` instead of `List.map2(xs, ys)(f)`", "2.8.0") - def map2[A,B,C](xs: List[A], ys: List[B])(f: (A, B) => C): List[C] = { - val b = new ListBuffer[C] - var xc = xs - var yc = ys - while (!xc.isEmpty && !yc.isEmpty) { - b += f(xc.head, yc.head) - xc = xc.tail - yc = yc.tail - } - b.toList - } - - /** Returns the list resulting from applying the given function - * `f` to corresponding elements of the argument lists. - * - * @param f function to apply to each pair of elements. - * @return `[f(a,,0,,,b,,0,,,c,,0,,), ..., f(a,,n,,,b,,n,,,c,,n,,)]` - * if the lists are `[a,,0,,, ..., a,,k,,]`, - * `[b<sub>0</sub>, ..., b,,l,,]`, - * `[c<sub>0</sub>, ..., c,,m,,]` and `n = min(k,l,m)` - */ - @deprecated("use `(xs, ys, zs).zipped.map(f)` instead of `List.map3(xs, ys, zs)(f)`", "2.8.0") - def map3[A,B,C,D](xs: List[A], ys: List[B], zs: List[C])(f: (A, B, C) => D): List[D] = { - val b = new ListBuffer[D] - var xc = xs - var yc = ys - var zc = zs - while (!xc.isEmpty && !yc.isEmpty && !zc.isEmpty) { - b += f(xc.head, yc.head, zc.head) - xc = xc.tail - yc = yc.tail - zc = zc.tail - } - b.toList - } - - /** Tests whether the given predicate `p` holds - * for all corresponding elements of the argument lists. - * - * @param p function to apply to each pair of elements. - * @return `(p(a<sub>0</sub>,b<sub>0</sub>) && - * ... && p(a<sub>n</sub>,b<sub>n</sub>))]` - * if the lists are `[a<sub>0</sub>, ..., a<sub>k</sub>]`; - * `[b<sub>0</sub>, ..., b<sub>l</sub>]` - * and `n = min(k,l)` - */ - @deprecated("use `(xs, ys).zipped.forall(f)` instead of `List.forall2(xs, ys)(f)`", "2.8.0") - def forall2[A,B](xs: List[A], ys: List[B])(f: (A, B) => Boolean): Boolean = { - var xc = xs - var yc = ys - while (!xc.isEmpty && !yc.isEmpty) { - if (!f(xc.head, yc.head)) return false - xc = xc.tail - yc = yc.tail - } - true - } - - /** Tests whether the given predicate `p` holds - * for some corresponding elements of the argument lists. - * - * @param p function to apply to each pair of elements. - * @return `n != 0 && (p(a<sub>0</sub>,b<sub>0</sub>) || - * ... || p(a<sub>n</sub>,b<sub>n</sub>))]` if the lists are - * `[a<sub>0</sub>, ..., a<sub>k</sub>]`, - * `[b<sub>0</sub>, ..., b<sub>l</sub>]` and - * `n = min(k,l)` - */ - @deprecated("use `(xs, ys).zipped.exists(f)` instead of `List.exists2(xs, ys)(f)`", "2.8.0") - def exists2[A,B](xs: List[A], ys: List[B])(f: (A, B) => Boolean): Boolean = { - var xc = xs - var yc = ys - while (!xc.isEmpty && !yc.isEmpty) { - if (f(xc.head, yc.head)) return true - xc = xc.tail - yc = yc.tail - } - false - } - - /** Transposes a list of lists. - * pre: All element lists have the same length. - * - * @param xss the list of lists - * @return the transposed list of lists - */ - @deprecated("use `xss.transpose` instead of `List.transpose(xss)`", "2.8.0") - def transpose[A](xss: List[List[A]]): List[List[A]] = { - val buf = new ListBuffer[List[A]] - var yss = xss - while (!yss.head.isEmpty) { - buf += (yss map (_.head)) - yss = (yss map (_.tail)) - } - buf.toList - } } /** Only used for list serialization */ diff --git a/src/library/scala/collection/immutable/Map.scala b/src/library/scala/collection/immutable/Map.scala index ea16e04ebe..82cf050f43 100644 --- a/src/library/scala/collection/immutable/Map.scala +++ b/src/library/scala/collection/immutable/Map.scala @@ -93,16 +93,6 @@ object Map extends ImmutableMapFactory[Map] { def - (key: Any): Map[Any, Nothing] = this } - @deprecated("use `Map.empty` instead", "2.8.0") - class EmptyMap[A,B] extends Map[A,B] with Serializable { - override def size: Int = 0 - def get(key: A): Option[B] = None - def iterator: Iterator[(A, B)] = Iterator.empty - override def updated [B1] (key: A, value: B1): Map[A, B1] = new Map1(key, value) - def + [B1](kv: (A, B1)): Map[A, B1] = updated(kv._1, kv._2) - def - (key: A): Map[A, B] = this - } - class Map1[A, +B](key1: A, value1: B) extends Map[A, B] with Serializable { override def size = 1 def get(key: A): Option[B] = diff --git a/src/library/scala/collection/immutable/Queue.scala b/src/library/scala/collection/immutable/Queue.scala index 75c3845f04..892f75ae91 100644 --- a/src/library/scala/collection/immutable/Queue.scala +++ b/src/library/scala/collection/immutable/Queue.scala @@ -129,7 +129,4 @@ object Queue extends SeqFactory[Queue] { override def apply[A](xs: A*): Queue[A] = new Queue[A](Nil, xs.toList) private object EmptyQueue extends Queue[Nothing](Nil, Nil) { } - - @deprecated("Use Queue.empty instead", "2.8.0") - val Empty: Queue[Nothing] = Queue() } diff --git a/src/library/scala/collection/immutable/RedBlack.scala b/src/library/scala/collection/immutable/RedBlack.scala index bac60ac4f9..9906c9896e 100644 --- a/src/library/scala/collection/immutable/RedBlack.scala +++ b/src/library/scala/collection/immutable/RedBlack.scala @@ -35,12 +35,8 @@ abstract class RedBlack[A] extends Serializable { def delete(k: A): Tree[B] = blacken(del(k)) def range(from: Option[A], until: Option[A]): Tree[B] = blacken(rng(from, until)) def foreach[U](f: (A, B) => U) - @deprecated("use `foreach` instead", "2.8.0") - def visit[T](input: T)(f: (T, A, B) => (Boolean, T)): (Boolean, T) def toStream: Stream[(A,B)] def iterator: Iterator[(A, B)] - @deprecated("use `iterator` instead", "2.8.0") - def elements = iterator def upd[B1 >: B](k: A, v: B1): Tree[B1] def del(k: A): Tree[B] def smallest: NonEmpty[B] @@ -165,14 +161,6 @@ abstract class RedBlack[A] extends Serializable { right foreach f } - @deprecated("use `foreach` instead", "2.8.0") - def visit[T](input: T)(f: (T,A,B) => (Boolean, T)): (Boolean, T) = { - val left = this.left.visit(input)(f) - if (!left._1) return left - val middle = f(left._2, key, value) - if (!middle._1) return middle - return this.right.visit(middle._2)(f) - } override def rng(from: Option[A], until: Option[A]): Tree[B] = { if (from == None && until == None) return this if (from != None && isSmaller(key, from.get)) return right.rng(from, until); @@ -281,9 +269,6 @@ abstract class RedBlack[A] extends Serializable { def foreach[U](f: (A, Nothing) => U) {} - @deprecated("use `foreach` instead", "2.8.0") - def visit[T](input: T)(f: (T, A, Nothing) => (Boolean, T)) = (true, input) - def rng(from: Option[A], until: Option[A]) = this def first = throw new NoSuchElementException("empty map") def last = throw new NoSuchElementException("empty map") diff --git a/src/library/scala/collection/immutable/Set.scala b/src/library/scala/collection/immutable/Set.scala index cb2823aeda..89be64b1d2 100644 --- a/src/library/scala/collection/immutable/Set.scala +++ b/src/library/scala/collection/immutable/Set.scala @@ -58,16 +58,6 @@ object Set extends ImmutableSetFactory[Set] { override def foreach[U](f: Any => U): Unit = {} } - @deprecated("use `Set.empty` instead", "2.8.0") - class EmptySet[A] extends Set[A] with Serializable { - override def size: Int = 0 - def contains(elem: A): Boolean = false - def + (elem: A): Set[A] = new Set1(elem) - def - (elem: A): Set[A] = this - def iterator: Iterator[A] = Iterator.empty - override def foreach[U](f: A => U): Unit = {} - } - /** An optimized representation for immutable sets of size 1 */ @SerialVersionUID(1233385750652442003L) class Set1[A] private[collection] (elem1: A) extends Set[A] with Serializable { diff --git a/src/library/scala/collection/immutable/Stack.scala b/src/library/scala/collection/immutable/Stack.scala index b172908f85..238b3e414f 100644 --- a/src/library/scala/collection/immutable/Stack.scala +++ b/src/library/scala/collection/immutable/Stack.scala @@ -20,9 +20,6 @@ object Stack extends SeqFactory[Stack] { /** $genericCanBuildFromInfo */ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Stack[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]] def newBuilder[A]: Builder[A, Stack[A]] = new ArrayBuffer[A] mapResult (buf => new Stack(buf.toList)) - - @deprecated("Use Stack.empty instead", "2.8.0") - val Empty: Stack[Nothing] = Stack() } /** This class implements immutable stacks using a list-based data diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala index c32c5b3640..47bd5610b2 100644 --- a/src/library/scala/collection/immutable/Stream.scala +++ b/src/library/scala/collection/immutable/Stream.scala @@ -605,9 +605,6 @@ object Stream extends SeqFactory[Stream] { else Some((xs.head, xs.tail)) } - @deprecated("use #:: instead", "2.8.0") - lazy val lazy_:: = #:: - /** An alternative way of building and matching Streams using Stream.cons(hd, tl). */ object cons { @@ -702,54 +699,6 @@ object Stream extends SeqFactory[Stream] { private[immutable] def collectedTail[A, B, That](stream: Stream[A], pf: PartialFunction[A, B], bf: CanBuildFrom[Stream[A], B, That]) = { cons(pf(stream.head), stream.tail.collect(pf)(bf).asInstanceOf[Stream[B]]) } - - /** A stream containing all elements of a given iterator, in the order they are produced. - * @param it The iterator producing the stream's elements - */ - @deprecated("use it.toStream instead", "2.8.0") - def fromIterator[A](it: Iterator[A]): Stream[A] = it.toStream - - /** The concatenation of a sequence of streams - */ - @deprecated("use xs.flatten instead", "2.8.0") - def concat[A](xs: Iterable[Stream[A]]): Stream[A] = concat(xs.iterator) - - /** The concatenation of all streams returned by an iterator - */ - @deprecated("use xs.toStream.flatten instead", "2.8.0") - def concat[A](xs: Iterator[Stream[A]]): Stream[A] = xs.toStream.flatten //(conforms[Stream[A], scala.collection.Traversable[A]]) - - /** - * Create a stream with element values `v,,n+1,, = step(v,,n,,)` where - * `v,,0,, = start` and elements are in the range between `start` (inclusive) - * and `end` (exclusive). - * - * @param start the start value of the stream - * @param end the end value of the stream - * @param step the increment function of the stream, must be monotonically increasing or decreasing - * @return the stream starting at value `start`. - */ - @deprecated("use `iterate` instead.", "2.8.0") - def range(start: Int, end: Int, step: Int => Int): Stream[Int] = - iterate(start, end - start)(step) - - /** - * Create an infinite stream containing the given element. - * - * @param elem the element composing the resulting stream - * @return the stream containing an infinite number of elem - */ - @deprecated("use `continually` instead", "2.8.0") - def const[A](elem: A): Stream[A] = cons(elem, const(elem)) - - /** Create a stream containing several copies of an element. - * - * @param n the length of the resulting stream - * @param elem the element composing the resulting stream - * @return the stream composed of n elements all equal to elem - */ - @deprecated("use fill(n, elem) instead", "2.8.0") - def make[A](n: Int, elem: A): Stream[A] = fill(n)(elem) } diff --git a/src/library/scala/collection/mutable/AddingBuilder.scala b/src/library/scala/collection/mutable/AddingBuilder.scala deleted file mode 100644 index d7f739d240..0000000000 --- a/src/library/scala/collection/mutable/AddingBuilder.scala +++ /dev/null @@ -1,36 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala.collection -package mutable - -import generic._ - -/** The canonical builder for collections that are addable, i.e. that support - * an efficient `+` method which adds an element to the collection. - * - * Collections are built from their empty element using this `+` method. - * @param empty the empty element of the collection. - * @tparam Elem the type of elements that get added to the builder. - * @tparam To the type of the built collection. - * - * @note "efficient `+`" is not idle talk. Do not use this on mutable collections or any others - * for which `+` may perform an unshared copy! See GrowingBuilder comments for more. - * - * @author Martin Odersky - * @version 2.8 - * @since 2.8 - */ -@deprecated("Will be removed after scala 2.9", "2.8.0") -class AddingBuilder[Elem, To <: Addable[Elem, To] with collection.Iterable[Elem] with collection.IterableLike[Elem, To]](empty: To) -extends Builder[Elem, To] { - protected var elems: To = empty - def +=(x: Elem): this.type = { elems = elems + x; this } - def clear() { elems = empty } - def result: To = elems -} diff --git a/src/library/scala/collection/mutable/ArrayLike.scala b/src/library/scala/collection/mutable/ArrayLike.scala index bae6bd1164..62f2620498 100644 --- a/src/library/scala/collection/mutable/ArrayLike.scala +++ b/src/library/scala/collection/mutable/ArrayLike.scala @@ -46,22 +46,4 @@ trait ArrayLike[A, +Repr] extends IndexedSeqOptimized[A, Repr] { self => } override def stringPrefix = "Array" } - - @deprecated("use deep.toString instead", "2.8.0") - final def deepToString() = - deep.toString - - @deprecated("use deep.mkString instead", "2.8.0") - final def deepMkString(start: String, sep: String, end: String): String = - deep.mkString(start, sep, end) - - @deprecated("use deep.mkString instead", "2.8.0") - final def deepMkString(sep: String): String = - deepMkString("", sep, "") - - @deprecated("use array1.deep.equals(array2.deep) instead", "2.8.0") - final def deepEquals(that: Any): Boolean = that match { - case x: AnyRef if x.getClass.isArray => deep.equals(WrappedArray.make(x).deep) - case _ => false - } } diff --git a/src/library/scala/collection/mutable/ArrayStack.scala b/src/library/scala/collection/mutable/ArrayStack.scala index b8d817f310..23af7d481e 100644 --- a/src/library/scala/collection/mutable/ArrayStack.scala +++ b/src/library/scala/collection/mutable/ArrayStack.scala @@ -117,10 +117,6 @@ extends Seq[T] x } - /** View the top element of the stack. */ - @deprecated("use top instead", "2.8.0") - def peek = top - /** View the top element of the stack. * * Does not remove the element on the top. If the stack is empty, diff --git a/src/library/scala/collection/mutable/BufferLike.scala b/src/library/scala/collection/mutable/BufferLike.scala index 067911f75e..acf26e59eb 100644 --- a/src/library/scala/collection/mutable/BufferLike.scala +++ b/src/library/scala/collection/mutable/BufferLike.scala @@ -214,51 +214,6 @@ trait BufferLike[A, +This <: BufferLike[A, This] with Buffer[A]] */ def readOnly: scala.collection.Seq[A] = toSeq - /** Adds a number of elements in an array - * - * @param src the array - * @param start the first element to append - * @param len the number of elements to append - */ - @deprecated("replace by: `buf ++= src.view(start, end)`", "2.8.0") - def ++=(src: Array[A], start: Int, len: Int) { - var i = start - val end = i + len - while (i < end) { - this += src(i) - i += 1 - } - } - - /** Adds a single element to this collection and returns - * the collection itself. - * - * $compatMutate - * You are strongly recommended to use `+=` instead. - * - * @param elem the element to add. - */ - @deprecated("Use += instead if you intend to add by side effect to an existing collection.\n"+ - "Use `clone() +=` if you intend to create a new collection.", "2.8.0") - def + (elem: A): This = { +=(elem); repr } - - /** Adds two or more elements to this collection and returns - * the collection itself. - * - * $compatMutate - * You are strongly recommended to use `++=` instead. - * - * @param elem1 the first element to add. - * @param elem2 the second element to add. - * @param elems the remaining elements to add. - */ - @deprecated("Use ++= instead if you intend to add by side effect to an existing collection.\n"+ - "Use `clone() ++=` if you intend to create a new collection.", "2.8.0") - def + (elem1: A, elem2: A, elems: A*): This = { - this += elem1 += elem2 ++= elems - repr - } - /** Creates a new collection containing both the elements of this collection and the provided * traversable object. * diff --git a/src/library/scala/collection/mutable/BufferProxy.scala b/src/library/scala/collection/mutable/BufferProxy.scala index f7831a7d3f..6a6bdd0077 100644 --- a/src/library/scala/collection/mutable/BufferProxy.scala +++ b/src/library/scala/collection/mutable/BufferProxy.scala @@ -38,16 +38,6 @@ trait BufferProxy[A] extends Buffer[A] with Proxy { def apply(n: Int): A = self.apply(n) - /** Append a single element to this buffer and return - * the identity of the buffer. - * - * @param elem the element to append. - * @return the updated buffer. - */ - @deprecated("Use += instead if you intend to add by side effect to an existing collection.\n"+ - "Use `clone() ++=` if you intend to create a new collection.", "2.8.0") - override def +(elem: A): Buffer[A] = self.+(elem) - /** Append a single element to this buffer. * * @param elem the element to append. @@ -56,16 +46,6 @@ trait BufferProxy[A] extends Buffer[A] with Proxy { override def readOnly = self.readOnly - /** Appends a number of elements provided by a traversable object via its - * `foreach` method. The identity of the buffer is returned. - * - * @param iter the traversable object. - * @return the updated buffer. - */ - @deprecated("Use ++= instead if you intend to add by side effect to an existing collection.\n"+ - "Use `clone() ++=` if you intend to create a new collection.", "2.8.0") - override def ++(xs: GenTraversableOnce[A]): Buffer[A] = self.++(xs) - /** Appends a number of elements provided by a traversable object. * * @param xs the traversable object. diff --git a/src/library/scala/collection/mutable/HashTable.scala b/src/library/scala/collection/mutable/HashTable.scala index 004b112253..ffde88575a 100644 --- a/src/library/scala/collection/mutable/HashTable.scala +++ b/src/library/scala/collection/mutable/HashTable.scala @@ -196,10 +196,6 @@ trait HashTable[A, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashU } } - /** An iterator returning all entries */ - @deprecated("use entriesIterator instead", "2.8.0") - protected def entries: Iterator[Entry] = entriesIterator - /** Remove all entries from table */ protected def clearTable() { diff --git a/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala b/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala index 8e01908a97..c2fca46a8b 100644 --- a/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala +++ b/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala @@ -54,9 +54,6 @@ extends Map[A, B] with Serializable def iterator: Iterator[(A, B)] = imap.iterator - @deprecated("use `iterator` instead", "2.8.0") - override def elements = iterator - override def toList: List[(A, B)] = imap.toList override def update(key: A, value: B): Unit = { imap = imap.updated(key, value) } diff --git a/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala b/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala index 2c1da15153..c44b77a9c4 100644 --- a/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala +++ b/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala @@ -40,9 +40,6 @@ class ImmutableSetAdaptor[A](protected var set: immutable.Set[A]) extends Set[A] def iterator: Iterator[A] = set.iterator - @deprecated("use `iterator` instead", "2.8.0") - override def elements: Iterator[A] = iterator - def +=(elem: A): this.type = { set = set + elem; this } def -=(elem: A): this.type = { set = set - elem; this } diff --git a/src/library/scala/collection/mutable/MapLike.scala b/src/library/scala/collection/mutable/MapLike.scala index 38de28f084..e4b1458e53 100644 --- a/src/library/scala/collection/mutable/MapLike.scala +++ b/src/library/scala/collection/mutable/MapLike.scala @@ -160,13 +160,6 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]] ) override def -(key: A): This = clone() -= key - /** If given key is defined in this map, remove it and return associated value as an Option. - * If key is not present return None. - * @param key the key to be removed - */ - @deprecated("Use `remove` instead", "2.8.0") - def removeKey(key: A): Option[B] = remove(key) - /** Removes all bindings from the map. After this operation has completed, * the map will be empty. */ diff --git a/src/library/scala/collection/mutable/MultiMap.scala b/src/library/scala/collection/mutable/MultiMap.scala index 128ec0ff10..0f298c4a8a 100644 --- a/src/library/scala/collection/mutable/MultiMap.scala +++ b/src/library/scala/collection/mutable/MultiMap.scala @@ -36,9 +36,6 @@ trait MultiMap[A, B] extends Map[A, Set[B]] { */ protected def makeSet: Set[B] = new HashSet[B] - @deprecated("use addBinding instead", "2.8.0") - def add(key: A, value: B): this.type = addBinding(key, value) - /** Assigns the specified `value` to a specified `key`, replacing * the existing value assigned to that `key` if it is equal to * the specified value. Otherwise, simply adds another binding to diff --git a/src/library/scala/collection/mutable/MutableList.scala b/src/library/scala/collection/mutable/MutableList.scala index dbabeafd0a..b7eab5c2a9 100644 --- a/src/library/scala/collection/mutable/MutableList.scala +++ b/src/library/scala/collection/mutable/MutableList.scala @@ -105,9 +105,6 @@ extends LinearSeq[A] } } - @deprecated("use clear() instead", "2.8.0") - def reset() { clear() } - /** Returns an iterator over all elements of this list. */ override def iterator: Iterator[A] = first0.iterator diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala index f67aabc62d..469d2de495 100644 --- a/src/library/scala/collection/mutable/PriorityQueue.scala +++ b/src/library/scala/collection/mutable/PriorityQueue.scala @@ -91,23 +91,6 @@ class PriorityQueue[A](implicit val ord: Ordering[A]) } } - @deprecated( - "Use `+=` instead if you intend to add by side effect to an existing collection.\n"+ - "Use `clone() +=` if you intend to create a new collection.", "2.8.0" - ) - def +(elem: A): PriorityQueue[A] = { this.clone() += elem } - - /** Add two or more elements to this set. - * @param elem1 the first element. - * @param kv2 the second element. - * @param kvs the remaining elements. - */ - @deprecated( - "Use `++=` instead if you intend to add by side effect to an existing collection.\n"+ - "Use `clone() ++=` if you intend to create a new collection.", "2.8.0" - ) - def +(elem1: A, elem2: A, elems: A*) = { this.clone().+=(elem1, elem2, elems : _*) } - /** Inserts a single element into the priority queue. * * @param elem the element to insert. diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala index aa79d3df7e..0b3852fe61 100644 --- a/src/library/scala/collection/mutable/Stack.scala +++ b/src/library/scala/collection/mutable/Stack.scala @@ -121,10 +121,6 @@ extends Seq[A] */ def pushAll(xs: TraversableOnce[A]): this.type = { xs.seq foreach push ; this } - @deprecated("use pushAll", "2.8.0") - @migration(2, 8, "Stack ++= now pushes arguments on the stack from left to right.") - def ++=(xs: TraversableOnce[A]): this.type = pushAll(xs) - /** Returns the top element of the stack. This method will not remove * the element from the stack. An error is signaled if there is no * element on the stack. diff --git a/src/library/scala/collection/mutable/StackProxy.scala b/src/library/scala/collection/mutable/StackProxy.scala index d5439a1531..8884f03bbd 100644 --- a/src/library/scala/collection/mutable/StackProxy.scala +++ b/src/library/scala/collection/mutable/StackProxy.scala @@ -49,16 +49,6 @@ trait StackProxy[A] extends Stack[A] with Proxy { override def pushAll(xs: TraversableOnce[A]): this.type = { self pushAll xs; this } - /** Pushes all elements provided by an `Iterable` object on top of the - * stack. The elements are pushed in the order they are given out by - * the iterator. - * - * @param iter an iterable object - */ - @deprecated("use pushAll", "2.8.0") - override def ++=(xs: TraversableOnce[A]): this.type = { self ++= xs ; this } - - override def push(elem1: A, elem2: A, elems: A*): this.type = { self.push(elem1).push(elem2).pushAll(elems) this diff --git a/src/library/scala/collection/mutable/StringBuilder.scala b/src/library/scala/collection/mutable/StringBuilder.scala index c1558f522f..2cfab4713c 100644 --- a/src/library/scala/collection/mutable/StringBuilder.scala +++ b/src/library/scala/collection/mutable/StringBuilder.scala @@ -89,10 +89,6 @@ final class StringBuilder(private val underlying: JavaStringBuilder) */ def capacity: Int = underlying.capacity() - @deprecated("Use `ensureCapacity` instead. An assignment is misleading because\n"+ - "it can never decrease the capacity.", "2.8.0") - def capacity_=(n: Int) { ensureCapacity(n) } - /** Ensure that the capacity is at least the given argument. * If the argument is greater than the current capacity, new * storage will be allocated with size equal to the given @@ -368,31 +364,6 @@ final class StringBuilder(private val underlying: JavaStringBuilder) def insert(index: Int, x: Double): StringBuilder = insert(index, String.valueOf(x)) def insert(index: Int, x: Char): StringBuilder = insert(index, String.valueOf(x)) - @deprecated("Use appendAll instead. This method is deprecated because of the\n"+ - "possible confusion with `append(Any)`.", "2.8.0") - def append(x: Seq[Char]): StringBuilder = appendAll(x) - - @deprecated("use appendAll instead. This method is deprecated because\n"+ - "of the possible confusion with `append(Any)`.", "2.8.0") - def append(x: Array[Char]): StringBuilder = appendAll(x) - - @deprecated("use appendAll instead. This method is deprecated because\n"+ - "of the possible confusion with `append(Any, Int, Int)'.", "2.8.0") - def append(x: Array[Char], offset: Int, len: Int): StringBuilder = appendAll(x, offset, len) - - @deprecated("use insertAll instead. This method is deprecated because of the\n"+ - "possible confusion with `insert(Int, Any, Int, Int)'.", "2.8.0") - def insert(index: Int, str: Array[Char], offset: Int, len: Int): StringBuilder = - insertAll(index, str, offset, len) - - @deprecated("use insertAll instead. This method is deprecated because of\n"+ - "the possible confusion with `insert(Int, Any)'.", "2.8.0") - def insert(at: Int, x: Seq[Char]): StringBuilder = insertAll(at, x) - - @deprecated("use insertAll instead. This method is deprecated because of\n"+ - "the possible confusion with `insert(Int, Any)'.", "2.8.0") - def insert(at: Int, x: Array[Char]): StringBuilder = insertAll(at, x) - /** Finds the index of the first occurrence of the specified substring. * * @param str the target string to search for diff --git a/src/library/scala/collection/mutable/SynchronizedBuffer.scala b/src/library/scala/collection/mutable/SynchronizedBuffer.scala index d55ce8d684..23552e9d52 100644 --- a/src/library/scala/collection/mutable/SynchronizedBuffer.scala +++ b/src/library/scala/collection/mutable/SynchronizedBuffer.scala @@ -40,15 +40,6 @@ trait SynchronizedBuffer[A] extends Buffer[A] { super.apply(n) } - /** Append a single element to this buffer and return - * the identity of the buffer. - * - * @param elem the element to append. - */ - override def +(elem: A): Self = synchronized { - super.+(elem) - } - /** Append a single element to this buffer. * * @param elem the element to append. diff --git a/src/library/scala/concurrent/MailBox.scala b/src/library/scala/concurrent/MailBox.scala deleted file mode 100644 index 6f9e39d8de..0000000000 --- a/src/library/scala/concurrent/MailBox.scala +++ /dev/null @@ -1,177 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala.concurrent - -/** This class ... - * - * @author Martin Odersky - * @version 1.0, 12/03/2003 - */ -//class MailBox with Monitor with LinkedListQueueCreator { -@deprecated("use actors instead", "2.8.0") -class MailBox extends AnyRef with ListQueueCreator { - - type Message = AnyRef - - private abstract class PreReceiver { - var msg: Message = null - def isDefinedAt(msg: Message): Boolean - } - - private class Receiver[A](receiver: PartialFunction[Message, A]) extends PreReceiver { - - def isDefinedAt(msg: Message) = receiver.isDefinedAt(msg) - - def receive(): A = synchronized { - while (msg eq null) wait() - receiver(msg) - } - - def receiveWithin(msec: Long): A = synchronized { - if (msg eq null) wait(msec) - receiver(if (msg ne null) msg else TIMEOUT) - } - } - - private val messageQueue = queueCreate[Message] - private val receiverQueue = queueCreate[PreReceiver] - - /** Unconsumed messages. */ - private var sent = messageQueue.make - - /** Pending receivers. */ - private var receivers = receiverQueue.make - - /** - * Check whether the receiver can be applied to an unconsumed message. - * If yes, the message is extracted and associated with the receiver. - * Otherwise the receiver is appended to the list of pending receivers. - */ - private def scanSentMsgs[A](receiver: Receiver[A]): Unit = synchronized { - messageQueue.extractFirst(sent, msg => receiver.isDefinedAt(msg)) match { - case None => - receivers = receiverQueue.append(receivers, receiver) - case Some((msg, withoutMsg)) => - sent = withoutMsg - receiver.msg = msg - } - } - - /** - * First check whether a pending receiver is applicable to the sent - * message. If yes, the receiver is notified. Otherwise the message - * is appended to the linked list of sent messages. - */ - def send(msg: Message): Unit = synchronized { - receiverQueue.extractFirst(receivers, r => r.isDefinedAt(msg)) match { - case None => - sent = messageQueue.append(sent, msg) - case Some((receiver, withoutReceiver)) => - receivers = withoutReceiver - receiver.msg = msg - receiver synchronized { receiver.notify() } - } - } - - /** - * Block until there is a message in the mailbox for which the processor - * `f` is defined. - */ - def receive[A](f: PartialFunction[Message, A]): A = { - val r = new Receiver(f) - scanSentMsgs(r) - r.receive() - } - - /** - * Block until there is a message in the mailbox for which the processor - * `f` is defined or the timeout is over. - */ - def receiveWithin[A](msec: Long)(f: PartialFunction[Message, A]): A = { - val r = new Receiver(f) - scanSentMsgs(r) - r.receiveWithin(msec) - } - -} - - - -/** -* Module for dealing with queues. -*/ -@deprecated("use actors instead", "2.8.0") -trait QueueModule[A] { - /** Type of queues. */ - type T - /** Create an empty queue. */ - def make: T - /** Append an element to a queue. */ - def append(l: T, x: A): T - /** Extract an element satisfying a predicate from a queue. */ - def extractFirst(l: T, p: A => Boolean): Option[(A, T)] -} - -/** Inefficient but simple queue module creator. */ -@deprecated("use actors instead", "2.8.0") -trait ListQueueCreator { - def queueCreate[A]: QueueModule[A] = new QueueModule[A] { - type T = List[A] - def make: T = Nil - def append(l: T, x: A): T = l ::: x :: Nil - def extractFirst(l: T, p: A => Boolean): Option[(A, T)] = - l match { - case Nil => None - case head :: tail => - if (p(head)) - Some((head, tail)) - else - extractFirst(tail, p) match { - case None => None - case Some((x, without_x)) => Some((x, head :: without_x)) - } - } - } -} - -/** Efficient queue module creator based on linked lists. */ -@deprecated("use actors instead", "2.8.0") -trait LinkedListQueueCreator { - import scala.collection.mutable.LinkedList - def queueCreate[A >: Null <: AnyRef]: QueueModule[A] = new QueueModule[A] { - type T = (LinkedList[A], LinkedList[A]) // fst = the list, snd = last elem - def make: T = { - val l = new LinkedList[A](null, null) - (l, l) - } - def append(l: T, x: A): T = { - val atTail = new LinkedList(x, null) - l._2 append atTail; - (l._1, atTail) - } - def extractFirst(l: T, p: A => Boolean): Option[(A, T)] = { - var xs = l._1 - var xs1 = xs.next - while ((xs1 ne null) && !p(xs1.elem)) { - xs = xs1 - xs1 = xs1.next - } - if (xs1 ne null) { - xs.next = xs1.next - if (xs.next eq null) - Some((xs1.elem, (l._1, xs))) - else - Some((xs1.elem, l)) - } - else - None - } - } -} - diff --git a/src/library/scala/concurrent/TIMEOUT.scala b/src/library/scala/concurrent/TIMEOUT.scala deleted file mode 100644 index d0328928fa..0000000000 --- a/src/library/scala/concurrent/TIMEOUT.scala +++ /dev/null @@ -1,19 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala.concurrent - -/** - * The message sent to a message box when the period specified in - * `receiveWithin` expires. - * - * @author Martin Odersky - * @version 1.0, 10/03/2003 - */ -@deprecated("use actors instead", "2.8.0") -case object TIMEOUT diff --git a/src/library/scala/concurrent/ops.scala b/src/library/scala/concurrent/ops.scala index d0ea51db51..92220a8313 100644 --- a/src/library/scala/concurrent/ops.scala +++ b/src/library/scala/concurrent/ops.scala @@ -61,24 +61,6 @@ object ops (xp, getOrThrow(y.get)) } - /** - * @param start ... - * @param end ... - * @param p ... - */ - @deprecated("use `collection.parallel.ParIterable.foreach` instead", "2.9.0") - def replicate(start: Int, end: Int)(p: Int => Unit)(implicit runner: TaskRunner = defaultRunner) { - if (start == end) - () - else if (start + 1 == end) - p(start) - else { - val mid = (start + end) / 2 - spawn { replicate(start, mid)(p) } - replicate(mid, end)(p) - } - } - /* def parMap[a,b](f: a => b, xs: Array[a]): Array[b] = { val results = new Array[b](xs.length); diff --git a/src/library/scala/concurrent/pilib.scala b/src/library/scala/concurrent/pilib.scala deleted file mode 100644 index 246fe6d786..0000000000 --- a/src/library/scala/concurrent/pilib.scala +++ /dev/null @@ -1,206 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - - -package scala.concurrent - -/** Library for using Pi-calculus concurrent primitives in - * [[http://scala-lang.org/#_top Scala]]. As an example, the definition of - * a two-place buffer using the `pilib` library looks like: - * {{{ - * def Buffer[a](put: Chan[a], get: Chan[a]) { - * def B0 { choice ( put * { x => B1(x) } ) } - * def B1(x: a) { choice ( get(x) * B0, put * { y => B2(x, y) } ) } - * def B2(x: a, y: a) { choice ( get(x) * B1(y) ) } - * B0 - * } - * }}} - * - * @see <a href="http://scala-lang.org/docu/papers.html" target="_top"> - * PiLib: A Hosted Language for Pi-Calculus Style Concurrency</a> - * @author Vincent Cremet, Martin Odersky - * @version 1.0 - */ -@deprecated("use actors instead", "2.8.0") -object pilib { - - import TaskRunners.threadRunner - - //////////////////////////////// SPAWN ///////////////////////////////// - - /** - * Run several processes in parallel using the following syntax: - * `spawn < p,,1,, | ... | p,,n,, >`. - */ - abstract class Spawn { - def <(p: => Unit): Spawn - def |(p: => Unit): Spawn - def > (): Unit - } - val spawn = new Spawn { - //object spawn extends Spawn { // BUG ! - def <(p: => Unit): Spawn = { scala.concurrent.ops.spawn(p); this } - def |(p: => Unit): Spawn = { scala.concurrent.ops.spawn(p); this } - def > (): Unit = () - } - - /////////////////////////// GUARDED PROCESSES ////////////////////////// - - /** Untyped channel. */ - class UChan { - /** Default log function. */ - var log = (x: Any) => () - } - - /** An untyped guarded process. - * - * @param n channel name - * @param polarity input (true) or output (false) - * @param v transmitted value - * @param c continuation - */ - case class UGP(n: UChan, polarity: Boolean, v: Any, c: Any => Any) - - /** Typed guarded process. */ - class GP[a](n: UChan, polarity: Boolean, v: Any, c: Any => a) { - val untyped = UGP(n, polarity, v, c) - } - - //////////////////////////////// CHANNELS ////////////////////////////// - - /** - * Name on which one can emit, receive or that can be emitted or received - * during a communication. - */ - class Chan[A] extends UChan with Function1[A, Product[A]] { - - var defaultValue: A = _ - - /** Creates an input guarded process. */ - def input[B](c: A => B) = - new GP(this, true, (), x => c(x.asInstanceOf[A])) - - /** Creates an input guarded process. */ - def output[B](v: A, c: () => B) = - new GP(this, false, v, x => c()) - - /** Blocking read. */ - def read = { - var res: A = defaultValue - choice ( input(x => res = x) ) - res - } - - /** Blocking write. */ - def write(x: A) = - choice ( output(x, () => ()) ) - - /** Syntactic sugar for input. */ - def *[B](f: A => B) = - input(f) - - /** Syntactic sugar for output. */ - def apply(v: A) = - new Product(this, v) - - /** Attach a function to be evaluated at each communication event - * on this channel. Replace previous attached function. - */ - def attach(f: A => Unit) = - log = x => f(x.asInstanceOf[A]) - } - - class Product[A](c: Chan[A], v: A) { - def *[B](f: => B) = c.output(v, () => f) - } - - /////////////////////// SUM OF GUARDED PROCESSES /////////////////////// - - case class Sum(gs: List[UGP]) { - - /** Continuation of the sum. */ - var cont: () => Any = _ - - var initialized = false - - /** Block if not initialized otherwise continue with the - * continuation. - */ - def continue = synchronized { - if (!initialized) wait() - cont() - } - - /** Set the values of parameters and awake the sleeping sum. - * - * @param f ... - */ - def set(f: () => Any) = synchronized { - cont = f - initialized = true - notify() - } - } - - ///////////////////////////// COMMUNICATION //////////////////////////// - - private var sums: List[Sum] = Nil - - /** Test if two lists of guarded processes can communicate. - * - * @param gs1 ... - * @param gs2 ... - * @return ... - */ - private def matches(gs1: List[UGP], gs2: List[UGP]): Option[(() => Unit, () => Any, () => Any)] = - (gs1, gs2) match { - case (Nil, _) => None - case (_, Nil) => None - case (UGP(a1, d1, v1, c1) :: rest1, UGP(a2, d2, v2, c2) :: rest2) => - if (a1 == a2 && d1 == !d2) - Some(((() => if (d1) a1.log(v2) else a1.log(v1)), (() => c1(v2)), (() => c2(v1)))) - else matches(gs1, rest2) match { - case None => matches(rest1, gs2) - case Some(t) => Some(t) - } - } - - /** Test if the given sum can react with one of the pending sums. - * If yes then do the reaction otherwise append the sum at the end - * of the pending sums. - * - * @param s1 ... - * @param ss ... - * @return ... - */ - private def compare(s1: Sum, ss: List[Sum]): List[Sum] = - ss match { - case Nil => ss ::: List(s1) - case s2 :: rest => matches(s1.gs, s2.gs) match { - case None => s2 :: compare(s1, rest) - case Some((log, c1, c2)) => - log() - s1.set(c1) - s2.set(c2) - rest - } - } - - /** Pi-calculus non-deterministic choice. - * - * @param s ... - * @return ... - */ - def choice[A](s: GP[A]*): A = { - val sum = Sum(s.toList map { _.untyped }) - synchronized { sums = compare(sum, sums) } - (sum.continue).asInstanceOf[A] - } - -} diff --git a/src/library/scala/io/Source.scala b/src/library/scala/io/Source.scala index 09887efdae..6a96d6f285 100644 --- a/src/library/scala/io/Source.scala +++ b/src/library/scala/io/Source.scala @@ -187,15 +187,6 @@ abstract class Source extends Iterator[Char] { var nerrors = 0 var nwarnings = 0 - /** Convenience method, returns given line (not including newline) - * from Source. - * - * @param line the line index, first line is 1 - * @return the specified line. - * - */ - @deprecated("Use a collections method such as getLines().toIndexedSeq for random access.", "2.8.0") - def getLine(line: Int): String = lineNum(line) private def lineNum(line: Int): String = getLines() drop (line - 1) take 1 mkString class LineIterator() extends Iterator[String] { diff --git a/src/library/scala/io/UTF8Codec.scala b/src/library/scala/io/UTF8Codec.scala index 72a1dafc32..df0a36ef21 100644 --- a/src/library/scala/io/UTF8Codec.scala +++ b/src/library/scala/io/UTF8Codec.scala @@ -13,8 +13,7 @@ package scala.io * @author Martin Odersky * @version 1.0, 04/10/2004 */ -object UTF8Codec -{ +object UTF8Codec { final val UNI_REPLACEMENT_CHAR: Int = 0x0000FFFD final val UNI_REPLACEMENT_BYTES = Array[Byte](-17, -65, -67) @@ -29,36 +28,4 @@ object UTF8Codec // // Some useful locations: // http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt - - @deprecated("""Use new String(Array(ch), 0, 1).getBytes("UTF-8") instead""", "2.8.0") - def encode(ch: Int): Array[Byte] = - if ((Character getType ch) == Character.SURROGATE.toInt) UNI_REPLACEMENT_BYTES - else try new String(Array(ch), 0, 1) getBytes "UTF-8" catch { - case _: IllegalArgumentException => UNI_REPLACEMENT_BYTES - } - - @deprecated("Use Codec.toUTF8 instead", "2.8.0") - def encode(src: Array[Char], from: Int, dst: Array[Byte], to: Int, len: Int): Int = { - val bytes = Codec toUTF8 src.slice(from, from + len) - Array.copy(bytes, 0, dst, to, bytes.length) - bytes.length - } - - @deprecated("Use Codec.toUTF8 instead", "2.8.0") - def encode(s: String, dst: Array[Byte], to: Int): Int = - encode(s.toArray, 0, dst, to, s.length) - - @deprecated("Use Codec.toUTF8 instead", "2.8.0") - def encode(s: String): Array[Byte] = Codec toUTF8 s - - @deprecated("Use Codec.fromUTF8 instead", "2.8.0") - def decode(src: Array[Byte], from: Int, dst: Array[Char], to: Int, len: Int): Int = { - val chars = Codec fromUTF8 src.slice(from, from + len) - Array.copy(chars, 0, dst, to, chars.length) - chars.length - } - - @deprecated("Use Codec.fromUTF8 instead", "2.8.0") - def decode(src: Array[Byte], from: Int, len: Int): String = - Codec fromUTF8 src.slice(from, from + len) mkString } diff --git a/src/library/scala/math/package.scala b/src/library/scala/math/package.scala index 9e90b77fc6..8948722340 100644 --- a/src/library/scala/math/package.scala +++ b/src/library/scala/math/package.scala @@ -12,7 +12,130 @@ package scala * numeric operations such as elementary exponential, logarithmic, root and * trigonometric functions. */ -package object math extends MathCommon { +package object math { + /** The `double` value that is closer than any other to `e`, the base of + * the natural logarithms. + */ + val E = java.lang.Math.E + + /** The `double` value that is closer than any other to `pi`, the ratio of + * the circumference of a circle to its diameter. + */ + val Pi = java.lang.Math.PI + + /** Returns a `double` value with a positive sign, greater than or equal + * to `0.0` and less than `1.0`. + */ + def random: Double = java.lang.Math.random() + + def sin(x: Double): Double = java.lang.Math.sin(x) + def cos(x: Double): Double = java.lang.Math.cos(x) + def tan(x: Double): Double = java.lang.Math.tan(x) + def asin(x: Double): Double = java.lang.Math.asin(x) + def acos(x: Double): Double = java.lang.Math.acos(x) + def atan(x: Double): Double = java.lang.Math.atan(x) + + /** Converts an angle measured in degrees to an approximately equivalent + * angle measured in radians. + * + * @param x an angle, in degrees + * @return the measurement of the angle `x` in radians. + */ + def toRadians(x: Double): Double = java.lang.Math.toRadians(x) + + /** Converts an angle measured in radians to an approximately equivalent + * angle measured in degrees. + * + * @param x angle, in radians + * @return the measurement of the angle `x` in degrees. + */ + def toDegrees(x: Double): Double = java.lang.Math.toDegrees(x) + + /** Returns Euler's number `e` raised to the power of a `double` value. + * + * @param x the exponent to raise `e` to. + * @return the value `e^a^`, where `e` is the base of the natural + * logarithms. + */ + def exp(x: Double): Double = java.lang.Math.exp(x) + def log(x: Double): Double = java.lang.Math.log(x) + def sqrt(x: Double): Double = java.lang.Math.sqrt(x) + def IEEEremainder(x: Double, y: Double): Double = java.lang.Math.IEEEremainder(x, y) + + def ceil(x: Double): Double = java.lang.Math.ceil(x) + def floor(x: Double): Double = java.lang.Math.floor(x) + + /** Returns the `double` value that is closest in value to the + * argument and is equal to a mathematical integer. + * + * @param x a `double` value + * @return the closest floating-point value to a that is equal to a + * mathematical integer. + */ + def rint(x: Double): Double = java.lang.Math.rint(x) + + /** Converts rectangular coordinates `(x, y)` to polar `(r, theta)`. + * + * @param x the ordinate coordinate + * @param y the abscissa coordinate + * @return the ''theta'' component of the point `(r, theta)` in polar + * coordinates that corresponds to the point `(x, y)` in + * Cartesian coordinates. + */ + def atan2(y: Double, x: Double): Double = java.lang.Math.atan2(y, x) + + /** Returns the value of the first argument raised to the power of the + * second argument. + * + * @param x the base. + * @param y the exponent. + * @return the value `x^y^`. + */ + def pow(x: Double, y: Double): Double = java.lang.Math.pow(x, y) + + /** Returns the closest `long` to the argument. + * + * @param x a floating-point value to be rounded to a `long`. + * @return the value of the argument rounded to the nearest`long` value. + */ + def round(x: Float): Int = java.lang.Math.round(x) + def round(x: Double): Long = java.lang.Math.round(x) + def abs(x: Int): Int = java.lang.Math.abs(x) + def abs(x: Long): Long = java.lang.Math.abs(x) + def abs(x: Float): Float = java.lang.Math.abs(x) + def abs(x: Double): Double = java.lang.Math.abs(x) + + def max(x: Int, y: Int): Int = java.lang.Math.max(x, y) + def max(x: Long, y: Long): Long = java.lang.Math.max(x, y) + def max(x: Float, y: Float): Float = java.lang.Math.max(x, y) + def max(x: Double, y: Double): Double = java.lang.Math.max(x, y) + + def min(x: Int, y: Int): Int = java.lang.Math.min(x, y) + def min(x: Long, y: Long): Long = java.lang.Math.min(x, y) + def min(x: Float, y: Float): Float = java.lang.Math.min(x, y) + def min(x: Double, y: Double): Double = java.lang.Math.min(x, y) + + def signum(x: Double): Double = + if (x == 0d) 0d + else if (x < 0) -1.0 + else if (x > 0) 1.0 + else x // NaN + + def signum(x: Float): Float = + if (x == 0f) 0f + else if (x < 0) -1.0f + else if (x > 0) 1.0f + else x // NaN + + def signum(x: Long): Long = + if (x == 0l) 0l + else if (x < 0) -1l + else 1l + + def signum(x: Int): Int = + if (x == 0) 0 + else if (x < 0) -1 + else 1 // ----------------------------------------------------------------------- // root functions diff --git a/src/library/scala/package.scala b/src/library/scala/package.scala index 264fd18406..0c5d10b15e 100644 --- a/src/library/scala/package.scala +++ b/src/library/scala/package.scala @@ -123,70 +123,6 @@ package object scala { type unchecked = annotation.unchecked.unchecked type volatile = annotation.volatile */ - @deprecated("Use Tuple1(x) to create a 1-tuple.", "2.8.0") - def Tuple[A1](x1: A1) = Tuple1(x1) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2](x1: A1, x2: A2) = Tuple2(x1, x2) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3](x1: A1, x2: A2, x3: A3) = Tuple3(x1, x2, x3) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4](x1: A1, x2: A2, x3: A3, x4: A4) = Tuple4(x1, x2, x3, x4) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5) = Tuple5(x1, x2, x3, x4, x5) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6) = Tuple6(x1, x2, x3, x4, x5, x6) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7) = Tuple7(x1, x2, x3, x4, x5, x6, x7) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8) = Tuple8(x1, x2, x3, x4, x5, x6, x7, x8) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9) = Tuple9(x1, x2, x3, x4, x5, x6, x7, x8, x9) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10) = Tuple10(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11) = Tuple11(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12) = Tuple12(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13) = Tuple13(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14) = Tuple14(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15) = Tuple15(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16) = Tuple16(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17) = Tuple17(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17, x18: A18) = Tuple18(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17, x18: A18, x19: A19) = Tuple19(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17, x18: A18, x19: A19, x20: A20) = Tuple20(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17, x18: A18, x19: A19, x20: A20, x21: A21) = Tuple21(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21) - @deprecated("Use ((x1, x2, ...)) syntax to create Tuples", "2.8.0") - def Tuple[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22](x1: A1, x2: A2, x3: A3, x4: A4, x5: A5, x6: A6, x7: A7, x8: A8, x9: A9, x10: A10, x11: A11, x12: A12, x13: A13, x14: A14, x15: A15, x16: A16, x17: A17, x18: A18, x19: A19, x20: A20, x21: A21, x22: A22) = Tuple22(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22) - - @deprecated("use java.lang.Integer instead", "2.6.0") - type Integer = java.lang.Integer - @deprecated("use java.lang.Character instead", "2.6.0") - type Character = java.lang.Character - - @deprecated("use Iterable instead", "2.8.0") - type Collection[+A] = Iterable[A] - @deprecated("use Iterable instead", "2.8.0") - val Collection = Iterable - - @deprecated("use Seq instead", "2.8.0") - type Sequence[+A] = scala.collection.Seq[A] - @deprecated("use Seq instead", "2.8.0") - val Sequence = scala.collection.Seq - - @deprecated("use IndexedSeq instead", "2.8.0") - type RandomAccessSeq[+A] = scala.collection.IndexedSeq[A] - @deprecated("use IndexedSeq instead", "2.8.0") - val RandomAccessSeq = scala.collection.IndexedSeq @deprecated("use scala.annotation.Annotation instead", "2.9.0") type Annotation = scala.annotation.Annotation diff --git a/src/library/scala/runtime/AnyValCompanion.scala b/src/library/scala/runtime/AnyValCompanion.scala deleted file mode 100644 index fdb0e8f638..0000000000 --- a/src/library/scala/runtime/AnyValCompanion.scala +++ /dev/null @@ -1,14 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala.runtime - -/** See scala.AnyValCompanion. - */ -@deprecated("Use scala.AnyValCompanion instead", "2.8.0") -private[scala] trait AnyValCompanion extends scala.AnyValCompanion { }
\ No newline at end of file diff --git a/src/library/scala/runtime/RichChar.scala b/src/library/scala/runtime/RichChar.scala index 358faf47f5..ba939d6633 100644 --- a/src/library/scala/runtime/RichChar.scala +++ b/src/library/scala/runtime/RichChar.scala @@ -45,14 +45,4 @@ final class RichChar(val self: Char) extends IntegralProxy[Char] { // public static boolean isDefined(char ch) // public static boolean isJavaIdentifierStart(char ch) // public static boolean isJavaIdentifierPart(char ch) - - @deprecated("Use ch.toLower instead", "2.8.0") - def toLowerCase: Char = toLower - @deprecated("Use ch.toUpper instead", "2.8.0") - def toUpperCase: Char = toUpper - - @deprecated("Use ch.isLower instead", "2.8.0") - def isLowerCase: Boolean = isLower - @deprecated("Use ch.isUpper instead", "2.8.0") - def isUpperCase: Boolean = isUpper } diff --git a/src/library/scala/util/parsing/json/JSON.scala b/src/library/scala/util/parsing/json/JSON.scala index b0926d20e7..1464f80e3f 100644 --- a/src/library/scala/util/parsing/json/JSON.scala +++ b/src/library/scala/util/parsing/json/JSON.scala @@ -33,20 +33,6 @@ import scala.util.parsing.combinator.lexical._ object JSON extends Parser { /** - * Parse the given `JSON` string and return a list of elements. If the - * string is a `JSON` object it will be a list of pairs. If it's a `JSON` - * array it will be be a list of individual elements. - * - * @param input the given `JSON` string. - * @return an optional list of of elements. - */ - @deprecated("Use parseFull or parseRaw as needed.", "2.8.0") - def parse(input: String): Option[List[Any]] = parseRaw(input).map(unRaw).flatMap({ - case l : List[_] => Some(l) - case _ => None - }) - - /** * This method converts ''raw'' results back into the original, deprecated * form. */ diff --git a/src/library/scala/util/parsing/syntax/package.scala b/src/library/scala/util/parsing/syntax/package.scala deleted file mode 100644 index 59053e2f54..0000000000 --- a/src/library/scala/util/parsing/syntax/package.scala +++ /dev/null @@ -1,20 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2006-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala.util.parsing - -import scala.util.parsing.combinator.token - -// If deprecating the whole package worked, that's what would best -// be done, but it doesn't (yet) so it isn't. -package object syntax { - @deprecated("Moved to scala.util.parsing.combinator.token", "2.8.0") - type Tokens = token.Tokens - @deprecated("Moved to scala.util.parsing.combinator.token", "2.8.0") - type StdTokens = token.StdTokens -} diff --git a/src/library/scala/xml/HasKeyValue.scala b/src/library/scala/xml/HasKeyValue.scala deleted file mode 100644 index 55ac63e201..0000000000 --- a/src/library/scala/xml/HasKeyValue.scala +++ /dev/null @@ -1,24 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala.xml - -/** Use this class to match on (unprefixed) attribute values - * {{{ - * val hasName = new HasKeyValue("name") - * node match { - * case Node("foo", hasName(x), _*) => x // foo had attribute with key "name" and with value x - * } - * }}} - * - * @author Burak Emir - */ -@deprecated("Use UnprefixedAttribute's extractor", "2.8.0") -class HasKeyValue(key: String) { - def unapplySeq(x: MetaData): Option[Seq[Node]] = x.get(key) -} diff --git a/src/library/scala/xml/XML.scala b/src/library/scala/xml/XML.scala index 678028dd28..bc3033d081 100644 --- a/src/library/scala/xml/XML.scala +++ b/src/library/scala/xml/XML.scala @@ -49,14 +49,6 @@ object XML extends XMLLoader[Elem] def withSAXParser(p: SAXParser): XMLLoader[Elem] = new XMLLoader[Elem] { override val parser: SAXParser = p } - @deprecated("Use save() instead", "2.8.0") - final def saveFull(filename: String, node: Node, xmlDecl: Boolean, doctype: dtd.DocType): Unit = - save(filename, node, encoding, xmlDecl, doctype) - - @deprecated("Use save() instead", "2.8.0") - final def saveFull(filename: String, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType): Unit = - save(filename, node, enc, xmlDecl, doctype) - /** Saves a node to a file with given filename using given encoding * optionally with xmldecl and doctype declaration. * diff --git a/src/swing/scala/swing/Component.scala b/src/swing/scala/swing/Component.scala index 9b7fd726ef..dcbe1507c0 100644 --- a/src/swing/scala/swing/Component.scala +++ b/src/swing/scala/swing/Component.scala @@ -117,9 +117,6 @@ abstract class Component extends UIElement { def verify(c: javax.swing.JComponent) = v(UIElement.cachedWrapper[Component](c)) }) }*/ - - @deprecated("Use mouse instead", "2.8.0") lazy val Mouse = mouse - /** * Contains publishers for various mouse events. They are separated for * efficiency reasons. diff --git a/src/swing/scala/swing/GUIApplication.scala b/src/swing/scala/swing/GUIApplication.scala deleted file mode 100644 index 8c63115707..0000000000 --- a/src/swing/scala/swing/GUIApplication.scala +++ /dev/null @@ -1,30 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - - - -package scala.swing - -import event.Event -import javax.swing._ - -/** - * Convenience class with utility methods for GUI applications. - */ -@deprecated("Use SwingApplication instead", "2.8.0") class GUIApplication { - - /** - * Called before the GUI is created. Override to customize. - */ - def init() {} - - /** - * Initializes the framework and runs the given program. - */ - def run(prog: => Unit) = Swing.onEDT { init(); prog } -} diff --git a/src/swing/scala/swing/ListView.scala b/src/swing/scala/swing/ListView.scala index 9525efefa1..282d24696e 100644 --- a/src/swing/scala/swing/ListView.scala +++ b/src/swing/scala/swing/ListView.scala @@ -195,24 +195,13 @@ class ListView[A] extends Component { object indices extends Indices(peer.getSelectedIndices) { def -=(n: Int): this.type = { peer.removeSelectionInterval(n,n); this } def +=(n: Int): this.type = { peer.addSelectionInterval(n,n); this } - @deprecated("Use ListView.selection.leadIndex", "2.8.0") - def leadIndex: Int = peer.getSelectionModel.getLeadSelectionIndex - @deprecated("Use ListView.selection.anchorIndex", "2.8.0") - def anchorIndex: Int = peer.getSelectionModel.getAnchorSelectionIndex } - @deprecated("Use ListView.selectIndices", "2.8.0") - def selectIndices(ind: Int*) = peer.setSelectedIndices(ind.toArray) - /** * The currently selected items. */ object items extends scala.collection.SeqProxy[A] { def self = peer.getSelectedValues.map(_.asInstanceOf[A]) - @deprecated("Use ListView.selection.leadIndex", "2.8.0") - def leadIndex: Int = peer.getSelectionModel.getLeadSelectionIndex - @deprecated("Use ListView.selection.anchorIndex", "2.8.0") - def anchorIndex: Int = peer.getSelectionModel.getAnchorSelectionIndex } def intervalMode: IntervalMode.Value = IntervalMode(peer.getSelectionModel.getSelectionMode) diff --git a/src/swing/scala/swing/SimpleGUIApplication.scala b/src/swing/scala/swing/SimpleGUIApplication.scala deleted file mode 100644 index f12e43ff5f..0000000000 --- a/src/swing/scala/swing/SimpleGUIApplication.scala +++ /dev/null @@ -1,46 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -package scala.swing - -import javax.swing._ - -/** - * Extend this class for most simple UI applications. Clients need to - * implement the `top` method. Framework initialization is done by this class. - * - * In order to conform to Swing's threading policy, never implement top or any - * additional member that created Swing components as a value unless component - * creation happens on the EDT (see `Swing.onEDT` and `Swing.onEDTWait`). - * Lazy values are okay for the same reason if they are initialized on the EDT - * always. - */ -@deprecated("Use SimpleSwingApplication instead", "2.8.0") abstract class SimpleGUIApplication extends GUIApplication { - - /** - * A GUI application's version of the main method. Called by the default - * main method implementation provided by this class. - * Implement to return the top-level frame of this application. - */ - def top: Frame - - /** - * Calls top, packs the frame, and displays it. - */ - def main(args: Array[String]) = run { - val t = top - t.pack() - t.visible = true - } - - def resourceFromClassloader(path: String): java.net.URL = - this.getClass.getResource(path) - - def resourceFromUserDirectory(path: String): java.io.File = - new java.io.File(util.Properties.userDir, path) -} diff --git a/src/swing/scala/swing/SimpleSwingApplication.scala b/src/swing/scala/swing/SimpleSwingApplication.scala index 786c7b4711..cd0f2be874 100644 --- a/src/swing/scala/swing/SimpleSwingApplication.scala +++ b/src/swing/scala/swing/SimpleSwingApplication.scala @@ -1,8 +1,27 @@ package scala.swing +/** + * Extend this class for most simple UI applications. Clients need to + * implement the `top` method. Framework initialization is done by this class. + * + * In order to conform to Swing's threading policy, never implement top or any + * additional member that created Swing components as a value unless component + * creation happens on the EDT (see `Swing.onEDT` and `Swing.onEDTWait`). + * Lazy values are okay for the same reason if they are initialized on the EDT + * always. + */ abstract class SimpleSwingApplication extends SwingApplication { + + /** + * A GUI application's version of the main method. Called by the default + * main method implementation provided by this class. + * Implement to return the top-level frame of this application. + */ def top: Frame + /** + * Calls `top`, packs the frame, and displays it. + */ override def startup(args: Array[String]) { val t = top if (t.size == new Dimension(0,0)) t.pack() diff --git a/src/swing/scala/swing/SwingApplication.scala b/src/swing/scala/swing/SwingApplication.scala index 6da3ab2053..214001f72a 100644 --- a/src/swing/scala/swing/SwingApplication.scala +++ b/src/swing/scala/swing/SwingApplication.scala @@ -1,9 +1,17 @@ package scala.swing +/** Convenience class with utility methods for GUI applications. */ abstract class SwingApplication extends Reactor { + + /** Initializes the application and runs the given program. */ def main(args: Array[String]) = Swing.onEDT { startup(args) } + /** Called before the GUI is created. Override to customize. */ def startup(args: Array[String]) + + /** Finalizes the application by calling `shutdown` and exits.*/ def quit() { shutdown(); sys.exit(0) } + + /** Called before the application is exited. Override to customize. */ def shutdown() {} } diff --git a/src/swing/scala/swing/UIElement.scala b/src/swing/scala/swing/UIElement.scala index 9e505ea9a6..04e2217943 100644 --- a/src/swing/scala/swing/UIElement.scala +++ b/src/swing/scala/swing/UIElement.scala @@ -96,9 +96,6 @@ trait UIElement extends Proxy with LazyPublisher { def location = peer.getLocation def bounds = peer.getBounds def size = peer.getSize - @deprecated("Explicit size assignment for UIElements is not supported anymore. " + - "Use a layout manager or subclass Window.", "2.8.0") - def size_=(dim: Dimension) = peer.setSize(dim) def locale = peer.getLocale def toolkit = peer.getToolkit diff --git a/src/swing/scala/swing/Window.scala b/src/swing/scala/swing/Window.scala index c3918551db..7991026a69 100644 --- a/src/swing/scala/swing/Window.scala +++ b/src/swing/scala/swing/Window.scala @@ -61,7 +61,7 @@ abstract class Window extends UIElement with RootPanel with Publisher { outer => def setLocationRelativeTo(c: UIElement) { peer.setLocationRelativeTo(c.peer) } def centerOnScreen() { peer.setLocationRelativeTo(null) } def location_=(p: Point) { peer.setLocation(p) } - override def size_=(size: Dimension) { peer.setSize(size) } + def size_=(size: Dimension) { peer.setSize(size) } def bounds_=(rect: Rectangle) { peer.setBounds(rect) } def owner: Window = UIElement.cachedWrapper[Window](peer.getOwner) diff --git a/src/swing/scala/swing/event/ComponentEvent.scala b/src/swing/scala/swing/event/ComponentEvent.scala index d8cff46168..f338a15868 100644 --- a/src/swing/scala/swing/event/ComponentEvent.scala +++ b/src/swing/scala/swing/event/ComponentEvent.scala @@ -14,12 +14,3 @@ package event trait ComponentEvent extends UIEvent { val source: Component } - -@deprecated("Use UIElementMoved instead.", "2.8.0") -case class ComponentMoved(source: Component) extends ComponentEvent -@deprecated("Use UIElementResized instead.", "2.8.0") -case class ComponentResized(source: Component) extends ComponentEvent -@deprecated("Use UIElementShown instead.", "2.8.0") -case class ComponentShown(source: Component) extends ComponentEvent -@deprecated("Use UIElementHidden instead.", "2.8.0") -case class ComponentHidden(source: Component) extends ComponentEvent diff --git a/src/swing/scala/swing/test/LinePainting.scala b/src/swing/scala/swing/test/LinePainting.scala index 78a94dbab7..8588665ddc 100644 --- a/src/swing/scala/swing/test/LinePainting.scala +++ b/src/swing/scala/swing/test/LinePainting.scala @@ -1,9 +1,10 @@ package scala.swing package test + import scala.swing.Swing._ -import scala.swing.{MainFrame, Panel, SimpleGUIApplication} +import scala.swing.{MainFrame, Panel} import scala.swing.event._ -import java.awt.{Color, Dimension, Graphics, Graphics2D, Point, geom} +import java.awt.{Color, Graphics2D, Point, geom} /** * Dragging the mouse draws a simple graph diff --git a/test/files/jvm/annotations.scala b/test/files/jvm/annotations.scala index f32eb625e9..740a74226e 100644 --- a/test/files/jvm/annotations.scala +++ b/test/files/jvm/annotations.scala @@ -110,7 +110,7 @@ object Test4 { import java.lang.reflect.AnnotatedElement def printSourceAnnotation(a: Annotation) { val ann = a.asInstanceOf[SourceAnnotation] - println("@test.SourceAnnotation(mails=" + ann.mails.deepMkString("{", ",", "}") + + println("@test.SourceAnnotation(mails=" + ann.mails.deep.mkString("{", ",", "}") + ", value=" + ann.value + ")") } def printSourceAnnotations(target: AnnotatedElement) { diff --git a/test/files/jvm/backendBugUnapply.scala b/test/files/jvm/backendBugUnapply.scala index 5461b72f91..b4d029f478 100644 --- a/test/files/jvm/backendBugUnapply.scala +++ b/test/files/jvm/backendBugUnapply.scala @@ -1,14 +1,11 @@ object Test { - import scala.xml.{Node,HasKeyValue} - - def domatch(x:Node): Node = { - val hasBar = new HasKeyValue("bar") + import scala.xml.{Node,UnprefixedAttribute} + def domatch(x:Node) = x match { - case Node("foo", hasBar(z), _*) => z + case Node("foo", UnprefixedAttribute("bar", z, _), _*) => z case _ => null } - } def main(args: Array[String]): Unit = { println(domatch(<foo bar="baz"><hi/></foo>)) diff --git a/test/files/jvm/bigints.scala b/test/files/jvm/bigints.scala index 4f6a06b7e1..f0d05f8b71 100644 --- a/test/files/jvm/bigints.scala +++ b/test/files/jvm/bigints.scala @@ -41,11 +41,11 @@ object Test_BigDecimal { println("z <= 3 = " + (z <= 3)) println("3 < z = " + (3 < z)) - val a: BigDecimal= Math.MAX_LONG + val a: BigDecimal= Long.MaxValue val b: BigDecimal = 1 val c = a - b - println("c > MAX_LONG = " + (c > Math.MAX_LONG)) - println("c <= MAX_LONG = " + (c <= Math.MAX_LONG)) + println("c > MAX_LONG = " + (c > Long.MaxValue)) + println("c <= MAX_LONG = " + (c <= Long.MaxValue)) } } diff --git a/test/files/jvm/manifests.scala b/test/files/jvm/manifests.scala index 8b6c00f9a5..6bbea4d052 100644 --- a/test/files/jvm/manifests.scala +++ b/test/files/jvm/manifests.scala @@ -70,7 +70,7 @@ object Test2 { println() def loadArray[T](x: Array[Byte])(implicit m: reflect.Manifest[Array[T]]) = - load[Array[T]](x)(m).deepToString + load[Array[T]](x)(m).deep.toString println("Array()="+loadArray[Int](dump(Array(): Array[Int]))) println("Array(true)="+loadArray[Boolean](dump(Array(true)))) println("Array(a)="+loadArray[Char](dump(Array('a')))) diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check index 0717de2a8e..8704bcc643 100644 --- a/test/files/jvm/serialization.check +++ b/test/files/jvm/serialization.check @@ -2,11 +2,6 @@ a1 = Array[1,2,3] _a1 = Array[1,2,3] arrayEquals(a1, _a1): true -c1 = Cell(a) -_c1 = Cell(a) -c1 eq _c1: false, _c1 eq c1: false -c1 equals _c1: true, _c1 equals c1: true - e1 = Left(1) _e1 = Left(1) e1 eq _e1: false, _e1 eq e1: false diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala index 6a4e37bda9..1056f99848 100644 --- a/test/files/jvm/serialization.scala +++ b/test/files/jvm/serialization.scala @@ -56,15 +56,6 @@ object Test1_scala { println("arrayEquals(a1, _a1): " + arrayEquals(a1, _a1)) println() - // Cell - val c1 = new Cell('a') - val _c1: Cell[Char] = read(write(c1)) - println("c1 = " + c1) - println("_c1 = " + _c1) - println("c1 eq _c1: " + (c1 eq _c1) + ", _c1 eq c1: " + (_c1 eq c1)) - println("c1 equals _c1: " + (c1 equals _c1) + ", _c1 equals c1: " + (_c1 equals c1)) - println() - // Either val e1 = Left(1) val _e1: Either[Int, String] = read(write(e1)) diff --git a/test/files/jvm/unittest_xml.scala b/test/files/jvm/unittest_xml.scala index e3d69115bc..7163ce2d88 100644 --- a/test/files/jvm/unittest_xml.scala +++ b/test/files/jvm/unittest_xml.scala @@ -9,17 +9,16 @@ object Test { object MetaDataTest { - import scala.xml.{ HasKeyValue, TopScope, NamespaceBinding, Node, Atom, Text } + import scala.xml.{ TopScope, NamespaceBinding, Node, Atom, Text } def domatch(x:Node): Node = { - val hasBar = new HasKeyValue("bar") x match { - //case Node("foo", hasBar(z), _*) => z - case Node("foo", md, _*) if !hasBar.unapplySeq(md).isEmpty => + case Node("foo", md @ UnprefixedAttribute(_, value, _), _*) if !value.isEmpty => md("bar")(0) case _ => new Atom(3) } } + def run() { var x: MetaData = Null diff --git a/test/files/neg/bug1845.scala b/test/files/neg/bug1845.scala index ceb43a0552..dab448b7dd 100644 --- a/test/files/neg/bug1845.scala +++ b/test/files/neg/bug1845.scala @@ -1,6 +1,6 @@ import scala.util.parsing.combinator.syntactical.TokenParsers import scala.util.parsing.combinator.lexical.StdLexical -import scala.util.parsing.syntax.StdTokens +import scala.util.parsing.combinator.token._ class MyTokenParsers extends TokenParsers { import lexical._ diff --git a/test/files/neg/bug563.check b/test/files/neg/bug563.check index c10f504635..c592a56100 100644 --- a/test/files/neg/bug563.check +++ b/test/files/neg/bug563.check @@ -1,4 +1,4 @@ bug563.scala:6: error: missing parameter type - map(n,ptr => new Cell(ptr.elem)); + map(n,ptr => Option(ptr.get)); ^ one error found diff --git a/test/files/neg/bug563.scala b/test/files/neg/bug563.scala index 624b83b1fa..204ad3cbdd 100644 --- a/test/files/neg/bug563.scala +++ b/test/files/neg/bug563.scala @@ -1,7 +1,7 @@ object Test { def map[A,R](a : List[A], f : A => R) : List[R] = a.map(f); - def split(sn : Iterable[List[Cell[Int]]]) : Unit = + def split(sn : Iterable[List[Option[Int]]]) : Unit = for (n <- sn) - map(n,ptr => new Cell(ptr.elem)); + map(n,ptr => Option(ptr.get)); } diff --git a/test/files/neg/migration28.check b/test/files/neg/migration28.check index 4324cc0d0a..97146e88f7 100644 --- a/test/files/neg/migration28.check +++ b/test/files/neg/migration28.check @@ -1,8 +1,6 @@ -migration28.scala:5: error: method ++= in class Stack is deprecated: use pushAll - s ++= List(1,2,3) - ^ -migration28.scala:7: error: method foreach in class Stack has changed semantics: -Stack iterator and foreach now traverse in FIFO order. - s foreach (_ => ()) - ^ -two errors found +migration28.scala:4: error: method scanRight in trait TraversableLike has changed semantics: +This scanRight definition has changed in 2.9. +The previous behavior can be reproduced with scanRight.reverse. + List(1,2,3,4,5).scanRight(0)(_+_) + ^ +one error found diff --git a/test/files/neg/migration28.scala b/test/files/neg/migration28.scala index 090b32d690..facc9b36d2 100644 --- a/test/files/neg/migration28.scala +++ b/test/files/neg/migration28.scala @@ -1,10 +1,7 @@ object Test { import scala.collection.mutable._ - val s = new Stack[Int] - s ++= List(1,2,3) - s map (_ + 1) - s foreach (_ => ()) + List(1,2,3,4,5).scanRight(0)(_+_) def main(args: Array[String]): Unit = { diff --git a/test/files/neg/multi-array.check b/test/files/neg/multi-array.check index f8432a76b8..511caa126f 100644 --- a/test/files/neg/multi-array.check +++ b/test/files/neg/multi-array.check @@ -1,8 +1,4 @@ -multi-array.scala:6: warning: new Array(...) with multiple dimensions has been deprecated; use Array.ofDim(...) instead +multi-array.scala:7: error: too many arguments for constructor Array: (_length: Int)Array[T] val a: Array[Int] = new Array(10, 10) ^ -multi-array.scala:6: error: too many dimensions for array creation - val a: Array[Int] = new Array(10, 10) - ^ -one warning found one error found diff --git a/test/files/neg/multi-array.scala b/test/files/neg/multi-array.scala index 993a1c0865..b04e0fa0b1 100644 --- a/test/files/neg/multi-array.scala +++ b/test/files/neg/multi-array.scala @@ -1,7 +1,14 @@ -/** Check that a multi-dimensional array can't be created - * when the wrong number of arguments w.r.t. to the array's - * type is given. +/** Multi-dimensional array creation with `new` was removed in 2.10. + * The replacement Array.ofDim[Int](10,10) makes the original mistake + * which was tested here impossible. + * This test will fail now because the constructor doesn't exist anymore. */ class Foo { val a: Array[Int] = new Array(10, 10) } + +//Before removal of constructor non-unary Array constructors: +/** Check that a multi-dimensional array can't be created + * when the wrong number of arguments w.r.t. to the array's + * type is given. + */ diff --git a/test/files/neg/t3115.check b/test/files/neg/t3115.check deleted file mode 100644 index c128ff5f3f..0000000000 --- a/test/files/neg/t3115.check +++ /dev/null @@ -1,12 +0,0 @@ -t3115.scala:6: error: object Math in object sc is deprecated: - println(sc.Math) - ^ -t3115.scala:7: error: object Math is deprecated: use the scala.math package object instead. -(Example package object usage: scala.math.Pi ) - println(scala.Math) - ^ -t3115.scala:8: error: object Math is deprecated: use the scala.math package object instead. -(Example package object usage: scala.math.Pi ) - scala.Math.Pi - ^ -three errors found diff --git a/test/files/neg/t3115.flags b/test/files/neg/t3115.flags deleted file mode 100644 index d1b831ea87..0000000000 --- a/test/files/neg/t3115.flags +++ /dev/null @@ -1 +0,0 @@ --deprecation -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t3115.scala b/test/files/neg/t3115.scala deleted file mode 100755 index 3888085593..0000000000 --- a/test/files/neg/t3115.scala +++ /dev/null @@ -1,9 +0,0 @@ -object sc { - @deprecated("", "2.8.0") object Math -} - -object Test { - println(sc.Math) - println(scala.Math) - scala.Math.Pi -} diff --git a/test/files/neg/t3773.check b/test/files/neg/t3773.check deleted file mode 100644 index ea0e866161..0000000000 --- a/test/files/neg/t3773.check +++ /dev/null @@ -1,4 +0,0 @@ -t3773.scala:3: error: method elements in trait IterableLike is deprecated: use `iterator` instead - for ((v, t) <- m.elements) () - ^ -one error found diff --git a/test/files/neg/t3773.flags b/test/files/neg/t3773.flags deleted file mode 100644 index d1b831ea87..0000000000 --- a/test/files/neg/t3773.flags +++ /dev/null @@ -1 +0,0 @@ --deprecation -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t3773.scala b/test/files/neg/t3773.scala deleted file mode 100644 index 3b92ed2d23..0000000000 --- a/test/files/neg/t3773.scala +++ /dev/null @@ -1,5 +0,0 @@ -object t { - val m = Map(1 -> "one") - for ((v, t) <- m.elements) () -} - diff --git a/test/files/pos/MailBox.scala b/test/files/pos/MailBox.scala index 67b923ea3e..8e27bd362d 100644 --- a/test/files/pos/MailBox.scala +++ b/test/files/pos/MailBox.scala @@ -1,8 +1,9 @@ package test; -import scala.concurrent._; +import scala.actors.TIMEOUT; class MailBox { + private class LinkedList[a] { var elem: a = _; var next: LinkedList[a] = null; diff --git a/test/files/pos/bug927.scala b/test/files/pos/bug927.scala index 7d4c59d94c..c903f19867 100644 --- a/test/files/pos/bug927.scala +++ b/test/files/pos/bug927.scala @@ -5,7 +5,7 @@ object Test { case Stream.Empty => 0 case Stream.cons(hd, tl) => hd + sum(tl) } - val str: Stream[Int] = Stream.fromIterator(List(1,2,3).iterator) + val str: Stream[Int] = List(1,2,3).iterator.toStream assert(sum(str) == 6) } diff --git a/test/files/pos/depexists.scala b/test/files/pos/depexists.scala index d539c844c1..dff1917a47 100644 --- a/test/files/pos/depexists.scala +++ b/test/files/pos/depexists.scala @@ -1,5 +1,5 @@ object depexists { - val c: Cell[(a, b)] forSome { type a <: Number; type b <: (a, a) } = null + val c: Option[(a, b)] forSome { type a <: Number; type b <: (a, a) } = null val d = c } diff --git a/test/files/pos/unapplyComplex.scala b/test/files/pos/unapplyComplex.scala index 70158348c3..148fcc1bb6 100644 --- a/test/files/pos/unapplyComplex.scala +++ b/test/files/pos/unapplyComplex.scala @@ -14,14 +14,14 @@ object ComplexRect { def unapply(z:Complex): Option[Complex] = { if(z.isInstanceOf[ComplexRect]) Some(z) else z match { case ComplexPolar(mod, arg) => - Some(new ComplexRect(mod*Math.cos(arg), mod*Math.sin(arg))) + Some(new ComplexRect(mod*math.cos(arg), mod*math.sin(arg))) } } } object ComplexPolar { def unapply(z:Complex): Option[Complex] = { if(z.isInstanceOf[ComplexPolar]) Some(z) else z match { case ComplexRect(re,im) => - Some(new ComplexPolar(Math.sqrt(re*re + im*im), Math.atan(re/im))) + Some(new ComplexPolar(math.sqrt(re*re + im*im), math.atan(re/im))) } } } object Test { @@ -31,7 +31,7 @@ object Test { Console.println("mod"+mod+"arg"+arg) } val Komplex = ComplexRect - new ComplexPolar(Math.sqrt(2),Math.Pi / 4.0) match { + new ComplexPolar(math.sqrt(2),math.Pi / 4.0) match { case Komplex(re,im) => // z @ ??? Console.println("re"+re+" im"+im) } diff --git a/test/files/run/Course-2002-10.scala b/test/files/run/Course-2002-10.scala index e978bc8258..4cfa1deb04 100644 --- a/test/files/run/Course-2002-10.scala +++ b/test/files/run/Course-2002-10.scala @@ -2,7 +2,7 @@ // Programmation IV - 2002 - Week 10 //############################################################################ -import Math.{Pi, log} +import math.{Pi, log} object M0 { diff --git a/test/files/run/arrays.scala b/test/files/run/arrays.scala index cd1cf13793..ecebc78a6f 100644 --- a/test/files/run/arrays.scala +++ b/test/files/run/arrays.scala @@ -167,41 +167,39 @@ object Test { //########################################################################## // Values - import Math._ - val u0: Unit = (); val u1: Unit = (); val z0: Boolean = false; val z1: Boolean = true; - val b0: Byte = MIN_BYTE; + val b0: Byte = Byte.MinValue; val b1: Byte = 1; - val b2: Byte = MAX_BYTE; + val b2: Byte = Byte.MaxValue; - val s0: Short = MIN_SHORT; + val s0: Short = Short.MinValue; val s1: Short = 2; - val s2: Short = MAX_SHORT; + val s2: Short = Short.MaxValue; - val c0: Char = MIN_CHAR; + val c0: Char = Char.MinValue; val c1: Char = '3'; - val c2: Char = MAX_CHAR; + val c2: Char = Char.MaxValue; - val i0: Int = MIN_INT; + val i0: Int = Int.MinValue; val i1: Int = 4; - val i2: Int = MAX_INT; + val i2: Int = Int.MinValue; - val l0: Long = MIN_LONG; + val l0: Long = Long.MinValue; val l1: Int = 5; - val l2: Long = MAX_LONG; + val l2: Long = Long.MaxValue; - val f0: Float = MIN_FLOAT; + val f0: Float = Float.MinValue; val f1: Int = 6; - val f2: Float = MAX_FLOAT; + val f2: Float = Float.MaxValue; - val d0: Double = MIN_DOUBLE; + val d0: Double = Double.MinValue; val d1: Int = 7; - val d2: Double = MAX_DOUBLE; + val d2: Double = Double.MaxValue; val a0: Unit = (); val a1: Boolean = false; diff --git a/test/files/run/bug1044.scala b/test/files/run/bug1044.scala index 7ac5058607..4d37a40c81 100644 --- a/test/files/run/bug1044.scala +++ b/test/files/run/bug1044.scala @@ -1,4 +1,4 @@ object Test extends App { val ducks = Array[AnyRef]("Huey", "Dewey", "Louie"); - ducks.elements.asInstanceOf[Iterator[String]] + ducks.iterator.asInstanceOf[Iterator[String]] } diff --git a/test/files/run/bug1309.scala b/test/files/run/bug1309.scala index d753f4d96c..84963549a2 100644 --- a/test/files/run/bug1309.scala +++ b/test/files/run/bug1309.scala @@ -1,5 +1,5 @@ object Test { - def f(ras: => RandomAccessSeq[Byte]): RandomAccessSeq[Byte] = ras + def f(ras: => IndexedSeq[Byte]): IndexedSeq[Byte] = ras def main(args: Array[String]): Unit = { f(new Array[Byte](0)) diff --git a/test/files/run/bug2005.scala b/test/files/run/bug2005.scala index 4176709537..45da9fe5b2 100644 --- a/test/files/run/bug2005.scala +++ b/test/files/run/bug2005.scala @@ -1,6 +1,6 @@ object Test { def main(args: Array[String]) { - val a = new Array[Array[Int]](2,2) + val a = Array.ofDim[Int](2,2) test(a) } def test[A](t: Array[Array[A]]) { diff --git a/test/files/run/randomAccessSeq-apply.check b/test/files/run/indexedSeq-apply.check index d86bac9de5..d86bac9de5 100644 --- a/test/files/run/randomAccessSeq-apply.check +++ b/test/files/run/indexedSeq-apply.check diff --git a/test/files/run/randomAccessSeq-apply.scala b/test/files/run/indexedSeq-apply.scala index 9097038c51..39d4db2ce9 100644 --- a/test/files/run/randomAccessSeq-apply.scala +++ b/test/files/run/indexedSeq-apply.scala @@ -1,11 +1,11 @@ object Test extends App { - val empty = RandomAccessSeq() + val empty = IndexedSeq() assert(empty.isEmpty) - val single = RandomAccessSeq(1) + val single = IndexedSeq(1) assert(List(1) == single.toList) - val two = RandomAccessSeq("a", "b") + val two = IndexedSeq("a", "b") assert("a" == two.head) assert("b" == two.apply(1)) diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala index 88a2884fcc..31859cf867 100644 --- a/test/files/run/iq.scala +++ b/test/files/run/iq.scala @@ -7,7 +7,7 @@ import scala.collection.immutable.Queue object iq { def main { /* Create an empty queue. */ - val q: Queue[Int] = Queue.Empty + val q: Queue[Int] = Queue.empty /* Test isEmpty. * Expected: Empty @@ -45,7 +45,7 @@ object iq { */ Console.println("q5[5]: " + q5(5)) - val q5c: Queue[Int] = Queue.Empty.enqueue(List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) + val q5c: Queue[Int] = Queue.empty.enqueue(List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) /* Testing == * Expected: q5 == q9: true diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala index 5f77289343..60eccdc8cc 100644 --- a/test/files/run/iterators.scala +++ b/test/files/run/iterators.scala @@ -75,11 +75,11 @@ object Test { def check_fromArray: Int = { // ticket #429 val a = List(1, 2, 3, 4).toArray - var xs0 = Iterator.fromArray(a).toList; - var xs1 = Iterator.fromArray(a, 0, 1).toList; - var xs2 = Iterator.fromArray(a, 0, 2).toList; - var xs3 = Iterator.fromArray(a, 0, 3).toList; - var xs4 = Iterator.fromArray(a, 0, 4).toList; + var xs0 = a.iterator.toList; + var xs1 = a.slice(0, 1).iterator.toList; + var xs2 = a.slice(0, 2).iterator.toList; + var xs3 = a.slice(0, 3).iterator.toList; + var xs4 = a.slice(0, 4).iterator.toList; xs0.length + xs1.length + xs2.length + xs3.length + xs4.length } diff --git a/test/files/run/json.scala b/test/files/run/json.scala index 7b2b80718c..8ee8c347fd 100644 --- a/test/files/run/json.scala +++ b/test/files/run/json.scala @@ -7,8 +7,8 @@ object Test extends App { * toString comparison. */ def jsonToString(in : Any) : String = in match { case l : List[_] => "[" + l.map(jsonToString).mkString(", ") + "]" - case m : Map[String,_] => "{" + m.elements.toList - .sort({ (x,y) => x._1 < y._1 }) + case m : Map[String,_] => "{" + m.iterator.toList + .sortWith({ (x,y) => x._1 < y._1 }) .map({ case (k,v) => "\"" + k + "\": " + jsonToString(v) }) .mkString(", ") + "}" case s : String => "\"" + s + "\"" @@ -20,7 +20,7 @@ object Test extends App { */ def sortJSON(in : Any) : Any = in match { case l : List[_] => l.map(sortJSON) - case m : Map[String,_] => TreeMap(m.mapElements(sortJSON).elements.toSeq : _*) + case m : Map[String,_] => TreeMap(m.mapValues(sortJSON).iterator.toSeq : _*) // For the object versions, sort their contents, ugly casts and all... case JSONObject(data) => JSONObject(sortJSON(data).asInstanceOf[Map[String,Any]]) case JSONArray(data) => JSONArray(sortJSON(data).asInstanceOf[List[Any]]) @@ -62,7 +62,7 @@ object Test extends App { def stringDiff (expected : String, actual : String) { if (expected != actual) { // Figure out where the Strings differ and generate a marker - val mismatchPosition = expected.toList.zip(actual.toList).findIndexOf({case (x,y) => x != y}) match { + val mismatchPosition = expected.toList.zip(actual.toList).indexWhere({case (x,y) => x != y}) match { case -1 => Math.min(expected.length, actual.length) case x => x } diff --git a/test/files/run/lists-run.scala b/test/files/run/lists-run.scala index 9e9e49e818..13fca22982 100644 --- a/test/files/run/lists-run.scala +++ b/test/files/run/lists-run.scala @@ -25,7 +25,7 @@ object Test_multiset { assert(List(1, 2) == (ys intersect xs), "ys_intersect_xs") assert(List(1) == (xs diff ys), "xs_diff_ys") assert(List(2, 3) == (ys diff xs), "ys_diff_xs") - assert(isSubListOf(xs -- ys, xs diff ys), "xs_subset_ys") + assert(isSubListOf(xs filterNot (ys contains), xs diff ys), "xs_subset_ys") val zs = List(0, 1, 1, 2, 2, 2) assert(List(0, 1, 1, 2, 2, 2, 1, 2, 2, 3) == (zs union ys), "zs_union_ys") @@ -34,7 +34,7 @@ object Test_multiset { assert(List(1, 2, 2) == (ys intersect zs), "ys_intersect_zs") assert(List(0, 1, 2) == (zs diff ys), "zs_diff_ys") assert(List(3) == (ys diff zs), "ys_diff_zs") - assert(isSubListOf(zs -- ys, zs diff ys), "xs_subset_ys") + assert(isSubListOf(zs filterNot (ys contains), zs diff ys), "xs_subset_ys") val ws = List(2) assert(List(2, 1, 2, 2, 3) == (ws union ys), "ws_union_ys") @@ -43,7 +43,7 @@ object Test_multiset { assert(List(2) == (ys intersect ws), "ys_intersect_ws") assert(List() == (ws diff ys), "ws_diff_ys") assert(List(1, 2, 3) == (ys diff ws), "ys_diff_ws") - assert(isSubListOf(ws -- ys, ws diff ys), "ws_subset_ys") + assert(isSubListOf(ws filterNot (ys contains), ws diff ys), "ws_subset_ys") val vs = List(3, 2, 2, 1) assert(List(1, 1, 2, 3, 2, 2, 1) == (xs union vs), "xs_union_vs") @@ -52,11 +52,11 @@ object Test_multiset { assert(List(2, 1) == (vs intersect xs), "vs_intersect_xs") assert(List(1) == (xs diff vs), "xs_diff_vs") assert(List(3, 2) == (vs diff xs), "vs_diff_xs") - assert(isSubListOf(xs -- vs, xs diff vs), "xs_subset_vs") + assert(isSubListOf(xs filterNot (vs contains), xs diff vs), "xs_subset_vs") // tests adapted from Thomas Jung assert({ - def sort(zs: List[Int]) = zs sort ( _ > _ ) + def sort(zs: List[Int]) = zs sortWith ( _ > _ ) sort(xs intersect ys) == sort(ys intersect xs) }, "be symmetric after sorting") assert({ @@ -137,12 +137,12 @@ object Test2 { val ys1 = xs1 ::: List(4) assert(List(1, 2, 3, 4) == ys1, "check_:::") - val ys2 = ys1 - 4 + val ys2 = ys1 filterNot (_ == 4) assert(xs1 == ys2, "check_-") val n2 = (xs1 ++ ys1).length val n3 = (xs1 ++ Nil).length - val n4 = (xs1 ++ ((new collection.mutable.ArrayBuffer[Int]) + 0)).length + val n4 = (xs1 ++ ((new collection.mutable.ArrayBuffer[Int]) += 0)).length assert(14 == n2 + n3 + n4, "check_++") } } diff --git a/test/files/run/map_java_conversions.scala b/test/files/run/map_java_conversions.scala index 4f9f8a915a..a41fae3695 100644 --- a/test/files/run/map_java_conversions.scala +++ b/test/files/run/map_java_conversions.scala @@ -19,7 +19,7 @@ object Test { val concMap = new java.util.concurrent.ConcurrentHashMap[String, String] test(concMap) - val cmap = asConcurrentMap(concMap) + val cmap = asScalaConcurrentMap(concMap) cmap.putIfAbsent("absentKey", "absentValue") cmap.put("somekey", "somevalue") assert(cmap.remove("somekey", "somevalue") == true) diff --git a/test/files/run/multi-array.scala b/test/files/run/multi-array.scala index 4f3a8d305f..36e21ae539 100644 --- a/test/files/run/multi-array.scala +++ b/test/files/run/multi-array.scala @@ -1,6 +1,6 @@ object Test extends App { val a = Array(1, 2, 3) - println(a.deepToString) + println(a.deep.toString) val aaiIncomplete = new Array[Array[Array[Int]]](3) println(aaiIncomplete(0)) @@ -9,6 +9,6 @@ object Test extends App { println(aaiComplete.deep) for (i <- 0 until 3; j <- 0 until 3) aaiComplete(i)(j) = i + j - println(aaiComplete.deepToString) + println(aaiComplete.deep.toString) assert(aaiComplete.last.last == 4) } diff --git a/test/files/run/packrat1.scala b/test/files/run/packrat1.scala index 3c3ea07afb..31a1ea55e5 100644 --- a/test/files/run/packrat1.scala +++ b/test/files/run/packrat1.scala @@ -2,7 +2,7 @@ import scala.util.parsing.combinator._ import scala.util.parsing.combinator.syntactical.StandardTokenParsers import scala.util.parsing.input._ -import scala.util.parsing.syntax._ +import scala.util.parsing.combinator.token._ import scala.collection.mutable.HashMap diff --git a/test/files/run/packrat2.scala b/test/files/run/packrat2.scala index c25e5e9a85..b91a2eae46 100644 --- a/test/files/run/packrat2.scala +++ b/test/files/run/packrat2.scala @@ -2,7 +2,7 @@ import scala.util.parsing.combinator._ import scala.util.parsing.combinator.syntactical.StandardTokenParsers import scala.util.parsing.input._ -import scala.util.parsing.syntax._ +import scala.util.parsing.combinator.token._ import scala.collection.mutable.HashMap diff --git a/test/files/run/packrat3.scala b/test/files/run/packrat3.scala index 3820f05158..8eab8ec6d0 100644 --- a/test/files/run/packrat3.scala +++ b/test/files/run/packrat3.scala @@ -2,7 +2,7 @@ import scala.util.parsing.combinator._ import scala.util.parsing.combinator.syntactical.StandardTokenParsers import scala.util.parsing.input._ -import scala.util.parsing.syntax._ +import scala.util.parsing.combinator.token._ import scala.collection.mutable.HashMap diff --git a/test/files/run/repl-suppressed-warnings.check b/test/files/run/repl-suppressed-warnings.check index a8ab9296c0..ef9e5c1270 100644 --- a/test/files/run/repl-suppressed-warnings.check +++ b/test/files/run/repl-suppressed-warnings.check @@ -34,7 +34,7 @@ scala> object o { @serializable case class Heyooooo @deprecated("I'm an ironic deprecation warning") def f0 = 5 // where's this disappearing? - def f1 = scala.Math.Pi // and this? + def f1 = Double.Epsilon // and this? } warning: there were 6 deprecation warnings; re-run with -deprecation for details warning: there were 3 unchecked warnings; re-run with -unchecked for details diff --git a/test/files/run/repl-suppressed-warnings.scala b/test/files/run/repl-suppressed-warnings.scala index 2d96a8eb24..a79131fb2f 100644 --- a/test/files/run/repl-suppressed-warnings.scala +++ b/test/files/run/repl-suppressed-warnings.scala @@ -23,7 +23,7 @@ object o { @serializable case class Heyooooo @deprecated("I'm an ironic deprecation warning") def f0 = 5 // where's this disappearing? - def f1 = scala.Math.Pi // and this? + def f1 = Double.Epsilon // and this? } :warnings diff --git a/test/files/run/sort.scala b/test/files/run/sort.scala index b89ff22f54..eea3a2d645 100644 --- a/test/files/run/sort.scala +++ b/test/files/run/sort.scala @@ -1,9 +1,9 @@ object Test extends App { - println((1 to 100000).toList.sort(_<_).length) - println(List(1, 5, 10, 3, 2).toList.sort(_<_)) - println(List(1, 5, 10, 3, 2).toList.sort(_>_)) - println(List(10).toList.sort(_<_)) - println(List(10,9).toList.sort(_<_)) - println(List[Int]().toList.sort(_<_)) + println((1 to 100000).toList.sortWith(_<_).length) + println(List(1, 5, 10, 3, 2).toList.sortWith(_<_)) + println(List(1, 5, 10, 3, 2).toList.sortWith(_>_)) + println(List(10).toList.sortWith(_<_)) + println(List(10,9).toList.sortWith(_<_)) + println(List[Int]().toList.sortWith(_<_)) } diff --git a/test/files/run/stream_length.scala b/test/files/run/stream_length.scala index 68e9cad5ac..2808fbc495 100644 --- a/test/files/run/stream_length.scala +++ b/test/files/run/stream_length.scala @@ -5,7 +5,7 @@ object Test { if (depth == 0) Stream(bias) else { - Stream.concat(Stream.range(1, 100).map((x: Int) => walk(depth-1, bias + x))) + (Stream.iterate(1, 99)(_+1).map((x: Int) => walk(depth-1, bias + x))).flatten } } diff --git a/test/files/run/t0017.scala b/test/files/run/t0017.scala index e2a43a66ac..245cbb7e42 100644 --- a/test/files/run/t0017.scala +++ b/test/files/run/t0017.scala @@ -12,6 +12,6 @@ for (i <- Array.range(0, my_arr(0).length)) yield val transposed = transpose(my_arr) -println(transposed.deepToString) +println(transposed.deep.toString) } diff --git a/test/files/run/t0421.scala b/test/files/run/t0421.scala index 90adb31c4f..62be08c0fe 100644 --- a/test/files/run/t0421.scala +++ b/test/files/run/t0421.scala @@ -22,9 +22,9 @@ object Test extends App { } val a1 = Array(Array(0, 2, 4), Array(1, 3, 5)) - println(transpose(a1).deepMkString("[", ",", "]")) + println(transpose(a1).deep.mkString("[", ",", "]")) - println(matmul(Array(Array(2, 3)), Array(Array(5), Array(7))).deepMkString("[", ",", "]")) + println(matmul(Array(Array(2, 3)), Array(Array(5), Array(7))).deep.mkString("[", ",", "]")) - println(matmul(Array(Array(4)), Array(Array(6, 8))).deepMkString("[", ",", "]")) + println(matmul(Array(Array(4)), Array(Array(6, 8))).deep.mkString("[", ",", "]")) } diff --git a/test/files/run/t0677.scala b/test/files/run/t0677.scala index 65448ed42c..131fcc24a6 100644 --- a/test/files/run/t0677.scala +++ b/test/files/run/t0677.scala @@ -1,7 +1,6 @@ object Test extends App { class X[T: ClassManifest] { - val a = new Array[Array[T]](3,4) - val b = Array.ofDim[T](3, 4) + val a = Array.ofDim[T](3, 4) } val x = new X[String] x.a(1)(2) = "hello" diff --git a/test/files/run/t2417.scala b/test/files/run/t2417.scala index 31d4c143fa..6200e33025 100644 --- a/test/files/run/t2417.scala +++ b/test/files/run/t2417.scala @@ -3,7 +3,7 @@ object Test { def parallel(numThreads: Int)(block: => Unit) { var failure: Throwable = null - val threads = Array.fromFunction(i => new Thread { + val threads = Array.tabulate(numThreads)(i => new Thread { override def run { try { block @@ -11,7 +11,7 @@ object Test { case x => failure = x } } - })(numThreads) + }) for (t <- threads) t.start for (t <- threads) t.join if (failure != null) println("FAILURE: " + failure) @@ -74,4 +74,4 @@ object Test { testSet(5, 2, 1000000) println() } -}
\ No newline at end of file +} diff --git a/test/files/run/t2813.2.scala b/test/files/run/t2813.2.scala index 9a9a79da4d..f41f6451f4 100644 --- a/test/files/run/t2813.2.scala +++ b/test/files/run/t2813.2.scala @@ -15,20 +15,20 @@ object Test extends App { } def addAllOfNonCollectionWrapperAtZeroOnLinkedList() { - val l = new LinkedList[Int] + 1 + 2 + val l = new LinkedList[Int] += 1 += 2 l.addAll(0, List(10, 11)) assertListEquals((List(10, 11, 1, 2)), l) } def addAllOfCollectionWrapperAtZeroOnLinkedList() { - val l = new LinkedList[Int] + 1 + 2 - l.addAll(0, new LinkedList[Int] + 10 + 11) + val l = new LinkedList[Int] += 1 += 2 + l.addAll(0, new LinkedList[Int] += 10 += 11) assertListEquals((List(10, 11, 1, 2)), l) } def addAllOfCollectionWrapperAtZeroOnEmptyLinkedList() { val l = new LinkedList[Int] - l.addAll(0, new LinkedList[Int] + 10 + 11) + l.addAll(0, new LinkedList[Int] += 10 += 11) assertListEquals((List(10, 11)), l) } diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala index 333ec7c402..77b123f5ce 100644 --- a/test/files/run/tailcalls.scala +++ b/test/files/run/tailcalls.scala @@ -295,7 +295,7 @@ object Test { while (!stop) { try { calibrator.f(n, n); - if (n >= Math.MAX_INT / 2) error("calibration failure"); + if (n >= Int.MaxValue / 2) error("calibration failure"); n = 2 * n; } catch { case exception: compat.Platform.StackOverflowError => stop = true diff --git a/test/files/run/unapply.scala b/test/files/run/unapply.scala index 85c384ab1f..0c5a70e768 100644 --- a/test/files/run/unapply.scala +++ b/test/files/run/unapply.scala @@ -33,7 +33,7 @@ object VarFoo { object Foo { def unapply(x: Any): Option[Product2[Int, String]] = x match { - case y: Bar => Some(Tuple(y.size, y.name)) + case y: Bar => Some(y.size, y.name) case _ => None } def doMatch1(b:Bar) = b match { @@ -69,7 +69,7 @@ object Foo { object Mas { object Gaz { def unapply(x: Any): Option[Product2[Int, String]] = x match { - case y: Baz => Some(Tuple(y.size, y.name)) + case y: Baz => Some(y.size, y.name) case _ => None } } diff --git a/test/files/run/unittest_io.scala b/test/files/run/unittest_io.scala index 4d2869ec3b..2cadb9b1df 100644 --- a/test/files/run/unittest_io.scala +++ b/test/files/run/unittest_io.scala @@ -6,20 +6,25 @@ object Test { } object UTF8Tests { - import io.UTF8Codec.encode + def decode(ch: Int) = new String(Array(ch), 0, 1).getBytes("UTF-8") + def run() { - assert(new String( encode(0x004D), "utf8") == new String(Array(0x004D.asInstanceOf[Char]))) - assert(new String( encode(0x0430), "utf8") == new String(Array(0x0430.asInstanceOf[Char]))) - assert(new String( encode(0x4E8C), "utf8") == new String(Array(0x4E8C.asInstanceOf[Char]))) - assert(new String(encode(0x10302), "utf8") == new String(Array(0xD800.asInstanceOf[Char], + assert(new String( decode(0x004D), "utf8") == new String(Array(0x004D.asInstanceOf[Char]))) + assert(new String( decode(0x0430), "utf8") == new String(Array(0x0430.asInstanceOf[Char]))) + assert(new String( decode(0x4E8C), "utf8") == new String(Array(0x4E8C.asInstanceOf[Char]))) + assert(new String(decode(0x10302), "utf8") == new String(Array(0xD800.asInstanceOf[Char], 0xDF02.asInstanceOf[Char]))) // a client val test = "{\"a\":\"\\u0022\"}" - val Expected = ("a","\"") - assert(scala.util.parsing.json.JSON.parse(test) match { - case Some(List(Expected)) => true - case z => Console.println(z); false - }) + val expected = "a" -> "\"" + + val parsed = scala.util.parsing.json.JSON.parseFull(test) + val result = parsed == Some(Map(expected)) + if(result) + assert(result) + else { + Console.println(parsed); assert(result) + } } } diff --git a/test/files/specialized/spec-matrix.scala b/test/files/specialized/spec-matrix.scala index fb3ac91481..463a454692 100644 --- a/test/files/specialized/spec-matrix.scala +++ b/test/files/specialized/spec-matrix.scala @@ -2,7 +2,7 @@ */ class Matrix[@specialized A: ClassManifest](val rows: Int, val cols: Int) { - private val arr: Array[Array[A]] = new Array[Array[A]](rows, cols) + private val arr: Array[Array[A]] = Array.ofDim[A](rows, cols) def apply(i: Int, j: Int): A = { if (i < 0 || i >= rows || j < 0 || j >= cols) |