summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/util/package.scala2
-rw-r--r--src/library/scala/Predef.scala26
-rw-r--r--src/library/scala/collection/mutable/PriorityQueue.scala2
-rw-r--r--src/library/scala/concurrent/Future.scala28
-rw-r--r--src/library/scala/concurrent/duration/package.scala12
-rw-r--r--src/library/scala/concurrent/package.scala4
-rw-r--r--src/library/scala/util/Either.scala2
7 files changed, 40 insertions, 36 deletions
diff --git a/src/compiler/scala/tools/nsc/util/package.scala b/src/compiler/scala/tools/nsc/util/package.scala
index 0db351f918..cb46004174 100644
--- a/src/compiler/scala/tools/nsc/util/package.scala
+++ b/src/compiler/scala/tools/nsc/util/package.scala
@@ -75,7 +75,7 @@ package object util {
s"$clazz$msg @ $frame"
}
- implicit class StackTraceOps(val e: Throwable) extends AnyVal with StackTracing {
+ implicit class StackTraceOps(private val e: Throwable) extends AnyVal with StackTracing {
/** Format the stack trace, returning the prefix consisting of frames that satisfy
* a given predicate.
* The format is similar to the typical case described in the JavaDoc
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index 3b588e261f..cd96b5182c 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -244,33 +244,33 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef {
// implicit classes -----------------------------------------------------
- implicit final class ArrowAssoc[A](val __leftOfArrow: A) extends AnyVal {
- @inline def -> [B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y)
+ implicit final class ArrowAssoc[A](private val self: A) extends AnyVal {
+ @inline def -> [B](y: B): Tuple2[A, B] = Tuple2(self, y)
def →[B](y: B): Tuple2[A, B] = ->(y)
}
- implicit final class Ensuring[A](val __resultOfEnsuring: A) extends AnyVal {
- def ensuring(cond: Boolean): A = { assert(cond); __resultOfEnsuring }
- def ensuring(cond: Boolean, msg: => Any): A = { assert(cond, msg); __resultOfEnsuring }
- def ensuring(cond: A => Boolean): A = { assert(cond(__resultOfEnsuring)); __resultOfEnsuring }
- def ensuring(cond: A => Boolean, msg: => Any): A = { assert(cond(__resultOfEnsuring), msg); __resultOfEnsuring }
+ implicit final class Ensuring[A](private val self: A) extends AnyVal {
+ def ensuring(cond: Boolean): A = { assert(cond); self }
+ def ensuring(cond: Boolean, msg: => Any): A = { assert(cond, msg); self }
+ def ensuring(cond: A => Boolean): A = { assert(cond(self)); self }
+ def ensuring(cond: A => Boolean, msg: => Any): A = { assert(cond(self), msg); self }
}
- implicit final class StringFormat[A](val __stringToFormat: A) extends AnyVal {
+ implicit final class StringFormat[A](private val self: A) extends AnyVal {
/** Returns string formatted according to given `format` string.
* Format strings are as for `String.format`
* (@see java.lang.String.format).
*/
- @inline def formatted(fmtstr: String): String = fmtstr format __stringToFormat
+ @inline def formatted(fmtstr: String): String = fmtstr format self
}
- implicit final class StringAdd[A](val __thingToAdd: A) extends AnyVal {
- def +(other: String) = String.valueOf(__thingToAdd) + other
+ implicit final class StringAdd[A](private val self: A) extends AnyVal {
+ def +(other: String) = String.valueOf(self) + other
}
- implicit final class RichException(val __throwableToEnrich: Throwable) extends AnyVal {
+ implicit final class RichException(private val self: Throwable) extends AnyVal {
import scala.compat.Platform.EOL
- @deprecated("Use Throwable#getStackTrace", "2.11.0") def getStackTraceString = __throwableToEnrich.getStackTrace().mkString("", EOL, EOL)
+ @deprecated("Use Throwable#getStackTrace", "2.11.0") def getStackTraceString = self.getStackTrace().mkString("", EOL, EOL)
}
implicit final class SeqCharSequence(val __sequenceOfChars: scala.collection.IndexedSeq[Char]) extends CharSequence {
diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala
index 0220d33628..b949bec48a 100644
--- a/src/library/scala/collection/mutable/PriorityQueue.scala
+++ b/src/library/scala/collection/mutable/PriorityQueue.scala
@@ -43,7 +43,7 @@ class PriorityQueue[A](implicit val ord: Ordering[A])
{
import ord._
- private class ResizableArrayAccess[A] extends AbstractSeq[A] with ResizableArray[A] {
+ private class ResizableArrayAccess[A] extends AbstractSeq[A] with ResizableArray[A] with Serializable {
def p_size0 = size0
def p_size0_=(s: Int) = size0 = s
def p_array = array
diff --git a/src/library/scala/concurrent/Future.scala b/src/library/scala/concurrent/Future.scala
index b9f73c2872..dd86af0dd4 100644
--- a/src/library/scala/concurrent/Future.scala
+++ b/src/library/scala/concurrent/Future.scala
@@ -29,11 +29,11 @@ import scala.reflect.ClassTag
/** The trait that represents futures.
*
- * Asynchronous computations that yield futures are created with the `future` call:
+ * Asynchronous computations that yield futures are created with the `Future` call:
*
* {{{
* val s = "Hello"
- * val f: Future[String] = future {
+ * val f: Future[String] = Future {
* s + " future!"
* }
* f onSuccess {
@@ -67,8 +67,8 @@ import scala.reflect.ClassTag
* Example:
*
* {{{
- * val f = future { 5 }
- * val g = future { 3 }
+ * val f = Future { 5 }
+ * val g = Future { 3 }
* val h = for {
* x: Int <- f // returns Future(5)
* y: Int <- g // returns Future(3)
@@ -266,7 +266,7 @@ trait Future[+T] extends Awaitable[T] {
*
* Example:
* {{{
- * val f = future { 5 }
+ * val f = Future { 5 }
* val g = f filter { _ % 2 == 1 }
* val h = f filter { _ % 2 == 0 }
* Await.result(g, Duration.Zero) // evaluates to 5
@@ -291,7 +291,7 @@ trait Future[+T] extends Awaitable[T] {
*
* Example:
* {{{
- * val f = future { -5 }
+ * val f = Future { -5 }
* val g = f collect {
* case x if x < 0 => -x
* }
@@ -314,9 +314,9 @@ trait Future[+T] extends Awaitable[T] {
* Example:
*
* {{{
- * future (6 / 0) recover { case e: ArithmeticException => 0 } // result: 0
- * future (6 / 0) recover { case e: NotFoundException => 0 } // result: exception
- * future (6 / 2) recover { case e: ArithmeticException => 0 } // result: 3
+ * Future (6 / 0) recover { case e: ArithmeticException => 0 } // result: 0
+ * Future (6 / 0) recover { case e: NotFoundException => 0 } // result: exception
+ * Future (6 / 2) recover { case e: ArithmeticException => 0 } // result: 3
* }}}
*/
def recover[U >: T](pf: PartialFunction[Throwable, U])(implicit executor: ExecutionContext): Future[U] = {
@@ -334,8 +334,8 @@ trait Future[+T] extends Awaitable[T] {
* Example:
*
* {{{
- * val f = future { Int.MaxValue }
- * future (6 / 0) recoverWith { case e: ArithmeticException => f } // result: Int.MaxValue
+ * val f = Future { Int.MaxValue }
+ * Future (6 / 0) recoverWith { case e: ArithmeticException => f } // result: Int.MaxValue
* }}}
*/
def recoverWith[U >: T](pf: PartialFunction[Throwable, Future[U]])(implicit executor: ExecutionContext): Future[U] = {
@@ -373,8 +373,8 @@ trait Future[+T] extends Awaitable[T] {
*
* Example:
* {{{
- * val f = future { sys.error("failed") }
- * val g = future { 5 }
+ * val f = Future { sys.error("failed") }
+ * val g = Future { 5 }
* val h = f fallbackTo g
* Await.result(h, Duration.Zero) // evaluates to 5
* }}}
@@ -416,7 +416,7 @@ trait Future[+T] extends Awaitable[T] {
* The following example prints out `5`:
*
* {{{
- * val f = future { 5 }
+ * val f = Future { 5 }
* f andThen {
* case r => sys.error("runtime exception")
* } andThen {
diff --git a/src/library/scala/concurrent/duration/package.scala b/src/library/scala/concurrent/duration/package.scala
index b32d2b20cb..d166975445 100644
--- a/src/library/scala/concurrent/duration/package.scala
+++ b/src/library/scala/concurrent/duration/package.scala
@@ -40,15 +40,15 @@ package object duration {
implicit def pairLongToDuration(p: (Long, TimeUnit)): FiniteDuration = Duration(p._1, p._2)
implicit def durationToPair(d: Duration): (Long, TimeUnit) = (d.length, d.unit)
- implicit final class DurationInt(val n: Int) extends AnyVal with DurationConversions {
+ implicit final class DurationInt(private val n: Int) extends AnyVal with DurationConversions {
override protected def durationIn(unit: TimeUnit): FiniteDuration = Duration(n.toLong, unit)
}
- implicit final class DurationLong(val n: Long) extends AnyVal with DurationConversions {
+ implicit final class DurationLong(private val n: Long) extends AnyVal with DurationConversions {
override protected def durationIn(unit: TimeUnit): FiniteDuration = Duration(n, unit)
}
- implicit final class DurationDouble(val d: Double) extends AnyVal with DurationConversions {
+ implicit final class DurationDouble(private val d: Double) extends AnyVal with DurationConversions {
override protected def durationIn(unit: TimeUnit): FiniteDuration =
Duration(d, unit) match {
case f: FiniteDuration => f
@@ -59,17 +59,17 @@ package object duration {
/*
* Avoid reflection based invocation by using non-duck type
*/
- implicit final class IntMult(val i: Int) extends AnyVal {
+ implicit final class IntMult(private val i: Int) extends AnyVal {
def *(d: Duration) = d * i.toDouble
def *(d: FiniteDuration) = d * i.toLong
}
- implicit final class LongMult(val i: Long) extends AnyVal {
+ implicit final class LongMult(private val i: Long) extends AnyVal {
def *(d: Duration) = d * i.toDouble
def *(d: FiniteDuration) = d * i.toLong
}
- implicit final class DoubleMult(val f: Double) extends AnyVal {
+ implicit final class DoubleMult(private val f: Double) extends AnyVal {
def *(d: Duration) = d * f.toDouble
}
}
diff --git a/src/library/scala/concurrent/package.scala b/src/library/scala/concurrent/package.scala
index 2fe14a9c1a..cc1350f5a9 100644
--- a/src/library/scala/concurrent/package.scala
+++ b/src/library/scala/concurrent/package.scala
@@ -27,6 +27,8 @@ package object concurrent {
* @param executor the execution context on which the future is run
* @return the `Future` holding the result of the computation
*/
+ @deprecated("Use `Future { ... }` instead.", "2.11.0")
+ // removal planned for 2.13.0
def future[T](body: =>T)(implicit @deprecatedName('execctx) executor: ExecutionContext): Future[T] = Future[T](body)
/** Creates a promise object which can be completed with a value or an exception.
@@ -34,6 +36,8 @@ package object concurrent {
* @tparam T the type of the value in the promise
* @return the newly created `Promise` object
*/
+ @deprecated("Use `Promise[T]()` instead.", "2.11.0")
+ // removal planned for 2.13.0
def promise[T](): Promise[T] = Promise[T]()
/** Used to designate a piece of code which potentially blocks, allowing the current [[BlockContext]] to adjust
diff --git a/src/library/scala/util/Either.scala b/src/library/scala/util/Either.scala
index 523270b31c..b1a932be7e 100644
--- a/src/library/scala/util/Either.scala
+++ b/src/library/scala/util/Either.scala
@@ -216,7 +216,7 @@ object Either {
* r.merge: Seq[Int] // Vector(1)
* }}}
*/
- implicit class MergeableEither[A](val x: Either[A, A]) extends AnyVal {
+ implicit class MergeableEither[A](private val x: Either[A, A]) extends AnyVal {
def merge: A = x match {
case Left(a) => a
case Right(a) => a