diff options
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Predef.scala | 6 | ||||
-rw-r--r-- | src/library/scala/Responder.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/Range.scala | 16 | ||||
-rw-r--r-- | src/library/scala/math/BigDecimal.scala | 3 | ||||
-rw-r--r-- | src/library/scala/math/BigInt.scala | 3 | ||||
-rw-r--r-- | src/library/scala/reflect/ClassManifestDeprecatedApis.scala | 23 | ||||
-rw-r--r-- | src/library/scala/reflect/Manifest.scala | 12 | ||||
-rw-r--r-- | src/library/scala/runtime/WorksheetSupport.scala | 93 | ||||
-rw-r--r-- | src/library/scala/util/hashing/MurmurHash3.scala | 8 |
9 files changed, 26 insertions, 140 deletions
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index cd96b5182c..8900450fa3 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -26,8 +26,6 @@ import scala.io.ReadStdin * [[scala.collection.immutable.Set]], and the [[scala.collection.immutable.List]] * constructors ([[scala.collection.immutable.::]] and * [[scala.collection.immutable.Nil]]). - * The types `Pair` (a [[scala.Tuple2]]) and `Triple` (a [[scala.Tuple3]]), with - * simple constructors, are also provided. * * === Console I/O === * Predef provides a number of simple functions for console I/O, such as @@ -230,13 +228,17 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef { // tupling ------------------------------------------------------------ + @deprecated("Use built-in tuple syntax or Tuple2 instead", "2.11.0") type Pair[+A, +B] = Tuple2[A, B] + @deprecated("Use built-in tuple syntax or Tuple2 instead", "2.11.0") object Pair { def apply[A, B](x: A, y: B) = Tuple2(x, y) def unapply[A, B](x: Tuple2[A, B]): Option[Tuple2[A, B]] = Some(x) } + @deprecated("Use built-in tuple syntax or Tuple3 instead", "2.11.0") type Triple[+A, +B, +C] = Tuple3[A, B, C] + @deprecated("Use built-in tuple syntax or Tuple3 instead", "2.11.0") object Triple { def apply[A, B, C](x: A, y: B, z: C) = Tuple3(x, y, z) def unapply[A, B, C](x: Tuple3[A, B, C]): Option[Tuple3[A, B, C]] = Some(x) diff --git a/src/library/scala/Responder.scala b/src/library/scala/Responder.scala index 0a42ddb0ea..8a658e252a 100644 --- a/src/library/scala/Responder.scala +++ b/src/library/scala/Responder.scala @@ -18,6 +18,7 @@ package scala * @see class Responder * @since 2.1 */ +@deprecated("This object will be removed", "2.11.0") object Responder { /** Creates a responder that answer continuations with the constant `a`. @@ -58,6 +59,7 @@ object Responder { * @version 1.0 * @since 2.1 */ +@deprecated("This class will be removed", "2.11.0") abstract class Responder[+A] extends Serializable { def respond(k: A => Unit): Unit diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala index 34b2346851..00f398a4b0 100644 --- a/src/library/scala/collection/immutable/Range.scala +++ b/src/library/scala/collection/immutable/Range.scala @@ -117,22 +117,6 @@ extends scala.collection.AbstractSeq[Int] fail() } - @deprecated("Range.foreach() is now self-contained, making this auxiliary method redundant.", "2.10.1") - def validateRangeBoundaries(f: Int => Any): Boolean = { - validateMaxLength() - - start != Int.MinValue || end != Int.MinValue || { - var count = 0 - var num = start - while (count < numRangeElements) { - f(num) - count += 1 - num += step - } - false - } - } - final def apply(idx: Int): Int = { validateMaxLength() if (idx < 0 || idx >= numRangeElements) throw new IndexOutOfBoundsException(idx.toString) diff --git a/src/library/scala/math/BigDecimal.scala b/src/library/scala/math/BigDecimal.scala index 0a2da16523..d783dd29f5 100644 --- a/src/library/scala/math/BigDecimal.scala +++ b/src/library/scala/math/BigDecimal.scala @@ -158,8 +158,7 @@ object BigDecimal { * @author Stephane Micheloud * @version 1.0 */ -@deprecatedInheritance("This class will be made final.", "2.10.0") -class BigDecimal( +final class BigDecimal( val bigDecimal: BigDec, val mc: MathContext) extends ScalaNumber with ScalaNumericConversions with Serializable { diff --git a/src/library/scala/math/BigInt.scala b/src/library/scala/math/BigInt.scala index b25dbefebd..5e70bdc2f6 100644 --- a/src/library/scala/math/BigInt.scala +++ b/src/library/scala/math/BigInt.scala @@ -109,8 +109,7 @@ object BigInt { * @author Martin Odersky * @version 1.0, 15/07/2003 */ -@deprecatedInheritance("This class will be made final.", "2.10.0") -class BigInt(val bigInteger: BigInteger) extends ScalaNumber with ScalaNumericConversions with Serializable { +final class BigInt(val bigInteger: BigInteger) extends ScalaNumber with ScalaNumericConversions with Serializable { /** Returns the hash code for this BigInt. */ override def hashCode(): Int = if (isValidLong) unifiedPrimitiveHashcode() diff --git a/src/library/scala/reflect/ClassManifestDeprecatedApis.scala b/src/library/scala/reflect/ClassManifestDeprecatedApis.scala index 798746851a..ca7a3cddb8 100644 --- a/src/library/scala/reflect/ClassManifestDeprecatedApis.scala +++ b/src/library/scala/reflect/ClassManifestDeprecatedApis.scala @@ -16,6 +16,7 @@ import java.lang.{ Class => jClass } trait ClassManifestDeprecatedApis[T] extends OptManifest[T] { self: ClassManifest[T] => + // Still in use in target test.junit.comp. @deprecated("Use runtimeClass instead", "2.10.0") def erasure: jClass[_] = runtimeClass @@ -64,12 +65,12 @@ trait ClassManifestDeprecatedApis[T] extends OptManifest[T] { // when the erasure is the same, even before considering variance. !cannotMatch && { // this part is wrong for not considering variance - if (this.erasure == that.erasure) + if (this.runtimeClass == that.runtimeClass) subargs(this.typeArguments, that.typeArguments) // this part is wrong for punting unless the rhs has no type // arguments, but it's better than a blindfolded pinata swing. else - that.typeArguments.isEmpty && subtype(this.erasure, that.erasure) + that.typeArguments.isEmpty && subtype(this.runtimeClass, that.runtimeClass) } } @@ -91,29 +92,29 @@ trait ClassManifestDeprecatedApis[T] extends OptManifest[T] { @deprecated("Use wrap instead", "2.10.0") def arrayManifest: ClassManifest[Array[T]] = - ClassManifest.classType[Array[T]](arrayClass[T](erasure), this) + ClassManifest.classType[Array[T]](arrayClass[T](runtimeClass), this) override def newArray(len: Int): Array[T] = - java.lang.reflect.Array.newInstance(erasure, len).asInstanceOf[Array[T]] + java.lang.reflect.Array.newInstance(runtimeClass, len).asInstanceOf[Array[T]] @deprecated("Use wrap.newArray instead", "2.10.0") def newArray2(len: Int): Array[Array[T]] = - java.lang.reflect.Array.newInstance(arrayClass[T](erasure), len) + java.lang.reflect.Array.newInstance(arrayClass[T](runtimeClass), len) .asInstanceOf[Array[Array[T]]] @deprecated("Use wrap.wrap.newArray instead", "2.10.0") def newArray3(len: Int): Array[Array[Array[T]]] = - java.lang.reflect.Array.newInstance(arrayClass[Array[T]](arrayClass[T](erasure)), len) + java.lang.reflect.Array.newInstance(arrayClass[Array[T]](arrayClass[T](runtimeClass)), len) .asInstanceOf[Array[Array[Array[T]]]] @deprecated("Use wrap.wrap.wrap.newArray instead", "2.10.0") def newArray4(len: Int): Array[Array[Array[Array[T]]]] = - java.lang.reflect.Array.newInstance(arrayClass[Array[Array[T]]](arrayClass[Array[T]](arrayClass[T](erasure))), len) + java.lang.reflect.Array.newInstance(arrayClass[Array[Array[T]]](arrayClass[Array[T]](arrayClass[T](runtimeClass))), len) .asInstanceOf[Array[Array[Array[Array[T]]]]] @deprecated("Use wrap.wrap.wrap.wrap.newArray instead", "2.10.0") def newArray5(len: Int): Array[Array[Array[Array[Array[T]]]]] = - java.lang.reflect.Array.newInstance(arrayClass[Array[Array[Array[T]]]](arrayClass[Array[Array[T]]](arrayClass[Array[T]](arrayClass[T](erasure)))), len) + java.lang.reflect.Array.newInstance(arrayClass[Array[Array[Array[T]]]](arrayClass[Array[Array[T]]](arrayClass[Array[T]](arrayClass[T](runtimeClass)))), len) .asInstanceOf[Array[Array[Array[Array[Array[T]]]]]] @deprecated("Create WrappedArray directly instead", "2.10.0") @@ -131,7 +132,7 @@ trait ClassManifestDeprecatedApis[T] extends OptManifest[T] { protected def argString = if (typeArguments.nonEmpty) typeArguments.mkString("[", ", ", "]") - else if (erasure.isArray) "["+ClassManifest.fromClass(erasure.getComponentType)+"]" + else if (runtimeClass.isArray) "["+ClassManifest.fromClass(runtimeClass.getComponentType)+"]" else "" } @@ -221,7 +222,7 @@ object ClassManifestFactory { */ def abstractType[T](prefix: OptManifest[_], name: String, upperbound: ClassManifest[_], args: OptManifest[_]*): ClassManifest[T] = new ClassManifest[T] { - override def runtimeClass = upperbound.erasure + override def runtimeClass = upperbound.runtimeClass override val typeArguments = args.toList override def toString = prefix.toString+"#"+name+argString } @@ -236,6 +237,6 @@ private class ClassTypeManifest[T]( { override def toString = (if (prefix.isEmpty) "" else prefix.get.toString+"#") + - (if (erasure.isArray) "Array" else erasure.getName) + + (if (runtimeClass.isArray) "Array" else runtimeClass.getName) + argString }
\ No newline at end of file diff --git a/src/library/scala/reflect/Manifest.scala b/src/library/scala/reflect/Manifest.scala index 3bc76da295..803c980058 100644 --- a/src/library/scala/reflect/Manifest.scala +++ b/src/library/scala/reflect/Manifest.scala @@ -46,7 +46,7 @@ trait Manifest[T] extends ClassManifest[T] with Equals { override def typeArguments: List[Manifest[_]] = Nil override def arrayManifest: Manifest[Array[T]] = - Manifest.classType[Array[T]](arrayClass[T](erasure), this) + Manifest.classType[Array[T]](arrayClass[T](runtimeClass), this) override def canEqual(that: Any): Boolean = that match { case _: Manifest[_] => true @@ -56,10 +56,10 @@ trait Manifest[T] extends ClassManifest[T] with Equals { * faster than <:< and rules out most comparisons. */ override def equals(that: Any): Boolean = that match { - case m: Manifest[_] => (m canEqual this) && (this.erasure == m.erasure) && (this <:< m) && (m <:< this) + case m: Manifest[_] => (m canEqual this) && (this.runtimeClass == m.runtimeClass) && (this <:< m) && (m <:< this) case _ => false } - override def hashCode = this.erasure.## + override def hashCode = this.runtimeClass.## } // TODO undeprecated until Scala reflection becomes non-experimental @@ -238,7 +238,7 @@ object ManifestFactory { override val typeArguments: List[Manifest[_]]) extends Manifest[T] { override def toString = (if (prefix.isEmpty) "" else prefix.get.toString+"#") + - (if (erasure.isArray) "Array" else erasure.getName) + + (if (runtimeClass.isArray) "Array" else runtimeClass.getName) + argString } @@ -259,7 +259,7 @@ object ManifestFactory { */ def wildcardType[T](lowerBound: Manifest[_], upperBound: Manifest[_]): Manifest[T] = new Manifest[T] { - def runtimeClass = upperBound.erasure + def runtimeClass = upperBound.runtimeClass override def toString = "_" + (if (lowerBound eq Nothing) "" else " >: "+lowerBound) + @@ -269,7 +269,7 @@ object ManifestFactory { /** Manifest for the intersection type `parents_0 with ... with parents_n'. */ def intersectionType[T](parents: Manifest[_]*): Manifest[T] = new Manifest[T] { - def runtimeClass = parents.head.erasure + def runtimeClass = parents.head.runtimeClass override def toString = parents.mkString(" with ") } } diff --git a/src/library/scala/runtime/WorksheetSupport.scala b/src/library/scala/runtime/WorksheetSupport.scala deleted file mode 100644 index d86f8873aa..0000000000 --- a/src/library/scala/runtime/WorksheetSupport.scala +++ /dev/null @@ -1,93 +0,0 @@ -package scala.runtime -import java.io.{OutputStream, PrintStream} -import scala.runtime.ScalaRunTime.stringOf - -/** A utility object that's needed by the code that executes a worksheet. - */ -@deprecated("SI-6458: Instrumentation logic will be moved out of the compiler.","2.10.0") -object WorksheetSupport { - - /** The offset in the source which should be printed */ - private var currentOffset = 0 - - /** A stream that flushes in regular intervals so that output can be captured - * in real time. The flush interval is determined by the field "flushInterval". - * By default it is 30ms. - */ - private class FlushedOutputStream(out: OutputStream) extends OutputStream { - protected def flushInterval = 30000000L // interval between flushes, by default 30ms - protected def width = 80 // output width, by default 80 characters - protected def tabInc = 8 // tab increment, by default 8 characters - private var lastFlush: Long = 0L - private var col = -1 - override def write(b: Array[Byte], off: Int, len: Int) = { - for (idx <- off until (off + len min b.length)) writeOne(b(idx).toInt) - flush() - } - override def write(c: Int) { - writeOne(c) - flush() - } - override def flush() { - val current = System.nanoTime - if (current - lastFlush >= flushInterval) { - out.flush() - lastFlush = current - } - } - def writeOne(c: Int) { - if (col < 0) { - col = 0 - write((currentOffset+" ").getBytes) - } - out.write(c) - col = - if (c == '\n') -1 - else if (c == '\t') (col / tabInc) * tabInc + tabInc - else col + 1 - if (col >= width) writeOne('\n') - } - def ensureNewLine() = if (col > 0) writeOne('\n') - } - - private val flushedOut = new FlushedOutputStream(System.out) - private val printOut = new PrintStream(flushedOut) - - private def redirected(op: => Unit) = { - val oldSysOut = System.out - val oldSysErr = System.err - val oldConsOut = Console.out - val oldConsErr = Console.err - System.setOut(printOut) - System.setErr(printOut) - Console.setOut(printOut) - Console.setErr(printOut) - try op - finally { - printOut.close() - System.setOut(oldSysOut) - System.setErr(oldSysErr) - Console.setOut(oldConsOut) - Console.setErr(oldConsErr) - } - } - - def $execute(op: => Unit) = redirected { - try op - catch { - case ex: StopException => ; - case ex: Throwable => ex.printStackTrace() - } - } - - def $skip(n: Int) = { - flushedOut.ensureNewLine() - currentOffset += n - } - - def $stop() = throw new StopException - - def $show(x: Any): String = stringOf(x) -} - -class StopException extends Exception diff --git a/src/library/scala/util/hashing/MurmurHash3.scala b/src/library/scala/util/hashing/MurmurHash3.scala index c85664349e..1bfaeb255b 100644 --- a/src/library/scala/util/hashing/MurmurHash3.scala +++ b/src/library/scala/util/hashing/MurmurHash3.scala @@ -275,12 +275,4 @@ object MurmurHash3 extends MurmurHash3 { finalizeHash(h, n) } */ - - @deprecated("Use unorderedHash", "2.10.0") - final def symmetricHash[T](xs: scala.collection.GenTraversableOnce[T], seed: Int = symmetricSeed): Int = - unorderedHash(xs.seq, seed) - - @deprecated("Use orderedHash", "2.10.0") - final def traversableHash[T](xs: scala.collection.GenTraversableOnce[T], seed: Int = traversableSeed): Int = - orderedHash(xs.seq, seed) } |