From afa6592ec054ce1ffd38e89bb251032e85f6ff6e Mon Sep 17 00:00:00 2001 From: Lifu Huang Date: Sun, 9 Oct 2016 09:02:55 +0800 Subject: Replace deprecated conforms Replace deprecated conforms with identity. --- src/library/scala/concurrent/Future.scala | 6 +++--- 1 file 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 -- cgit v1.2.3