diff options
author | Lifu Huang <lifu.hlf@gmail.com> | 2016-10-09 09:02:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-09 09:02:55 +0800 |
commit | afa6592ec054ce1ffd38e89bb251032e85f6ff6e (patch) | |
tree | 780489e5f85e9bee1ac2de841f67e9cd8efd71c7 | |
parent | 9d3f0777ff883a7c59da3fa7fee156890f51701e (diff) | |
download | scala-afa6592ec054ce1ffd38e89bb251032e85f6ff6e.tar.gz scala-afa6592ec054ce1ffd38e89bb251032e85f6ff6e.tar.bz2 scala-afa6592ec054ce1ffd38e89bb251032e85f6ff6e.zip |
Replace deprecated conforms
Replace deprecated conforms with identity.
-rw-r--r-- | src/library/scala/concurrent/Future.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library/scala/concurrent/Future.scala b/src/library/scala/concurrent/Future.scala index c0398605a6..6c1c9a0c80 100644 --- a/src/library/scala/concurrent/Future.scala +++ b/src/library/scala/concurrent/Future.scala @@ -116,7 +116,7 @@ trait Future[+T] extends Awaitable[T] { @deprecated("use `foreach` or `onComplete` instead (keep in mind that they take total rather than partial functions)", "2.12.0") def onSuccess[U](pf: PartialFunction[T, U])(implicit executor: ExecutionContext): Unit = onComplete { case Success(v) => - pf.applyOrElse[T, Any](v, Predef.conforms[T]) // Exploiting the cached function to avoid MatchError + pf.applyOrElse[T, Any](v, Predef.identity[T]) // Exploiting the cached function to avoid MatchError case _ => } @@ -141,7 +141,7 @@ trait Future[+T] extends Awaitable[T] { @deprecated("use `onComplete` or `failed.foreach` instead (keep in mind that they take total rather than partial functions)", "2.12.0") def onFailure[U](@deprecatedName('callback) pf: PartialFunction[Throwable, U])(implicit executor: ExecutionContext): Unit = onComplete { case Failure(t) => - pf.applyOrElse[Throwable, Any](t, Predef.conforms[Throwable]) // Exploiting the cached function to avoid MatchError + pf.applyOrElse[Throwable, Any](t, Predef.identity[Throwable]) // Exploiting the cached function to avoid MatchError case _ => } @@ -528,7 +528,7 @@ trait Future[+T] extends Awaitable[T] { def andThen[U](pf: PartialFunction[Try[T], U])(implicit executor: ExecutionContext): Future[T] = transform { result => - try pf.applyOrElse[Try[T], Any](result, Predef.conforms[Try[T]]) + try pf.applyOrElse[Try[T], Any](result, Predef.identity[Try[T]]) catch { case NonFatal(t) => executor reportFailure t } result |