diff options
26 files changed, 53 insertions, 62 deletions
diff --git a/src/actors-migration/scala/actors/Pattern.scala b/src/actors-migration/scala/actors/Pattern.scala index fa2db79152..a97ee3ba07 100644 --- a/src/actors-migration/scala/actors/Pattern.scala +++ b/src/actors-migration/scala/actors/Pattern.scala @@ -1,6 +1,6 @@ package scala.actors -import scala.concurrent.util.Duration +import scala.concurrent.duration.Duration import scala.language.implicitConversions object pattern { diff --git a/src/actors-migration/scala/actors/StashingActor.scala b/src/actors-migration/scala/actors/StashingActor.scala index 29f370a3e2..775d115d0b 100644 --- a/src/actors-migration/scala/actors/StashingActor.scala +++ b/src/actors-migration/scala/actors/StashingActor.scala @@ -1,7 +1,7 @@ package scala.actors import scala.collection._ -import scala.concurrent.util.Duration +import scala.concurrent.duration.Duration import java.util.concurrent.TimeUnit import scala.language.implicitConversions diff --git a/src/actors-migration/scala/actors/Timeout.scala b/src/actors-migration/scala/actors/Timeout.scala index 5540d2880e..c3017d8569 100644 --- a/src/actors-migration/scala/actors/Timeout.scala +++ b/src/actors-migration/scala/actors/Timeout.scala @@ -8,7 +8,7 @@ package scala.actors -import scala.concurrent.util.Duration +import scala.concurrent.duration.Duration import java.util.concurrent.TimeUnit import scala.language.implicitConversions diff --git a/src/actors/scala/actors/ActorRef.scala b/src/actors/scala/actors/ActorRef.scala index 8f70b13e01..7768f04c2b 100644 --- a/src/actors/scala/actors/ActorRef.scala +++ b/src/actors/scala/actors/ActorRef.scala @@ -1,7 +1,7 @@ package scala.actors import java.util.concurrent.TimeoutException -import scala.concurrent.util.Duration +import scala.concurrent.duration.Duration /** * Trait used for migration of Scala actors to Akka. diff --git a/src/library/scala/concurrent/Awaitable.scala b/src/library/scala/concurrent/Awaitable.scala index 655115349a..3bd7617bce 100644 --- a/src/library/scala/concurrent/Awaitable.scala +++ b/src/library/scala/concurrent/Awaitable.scala @@ -10,7 +10,7 @@ package scala.concurrent -import scala.concurrent.util.Duration +import scala.concurrent.duration.Duration diff --git a/src/library/scala/concurrent/util/Duration.scala b/src/library/scala/concurrent/duration/Duration.scala index c980170f0d..273b6934d6 100644 --- a/src/library/scala/concurrent/util/Duration.scala +++ b/src/library/scala/concurrent/duration/Duration.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ -package scala.concurrent.util +package scala.concurrent.duration import java.util.concurrent.TimeUnit import TimeUnit._ @@ -161,11 +161,11 @@ object Duration { ) // TimeUnit => standard label - protected[util] val timeUnitName: Map[TimeUnit, String] = + protected[duration] val timeUnitName: Map[TimeUnit, String] = timeUnitLabels.toMap mapValues (s => words(s).last) toMap // Label => TimeUnit - protected[util] val timeUnit: Map[String, TimeUnit] = + protected[duration] val timeUnit: Map[String, TimeUnit] = timeUnitLabels flatMap { case (unit, names) => expandLabels(names) map (_ -> unit) } toMap /** @@ -774,7 +774,6 @@ final class FiniteDuration(val length: Long, val unit: TimeUnit) extends Duratio } trait DurationConversions extends Any { - import duration.Classifier protected def durationIn(unit: TimeUnit): FiniteDuration def nanoseconds = durationIn(NANOSECONDS) @@ -847,3 +846,23 @@ final class DurationDouble(val d: Double) extends AnyVal with DurationConversion case _ => throw new IllegalArgumentException("Duration DSL not applicable to " + d) } } + +trait Classifier[C] { + type R + def convert(d: FiniteDuration): R +} + +/* + * Avoid reflection based invocation by using non-duck type + */ +protected[duration] class IntMult(i: Int) { + def *(d: Duration) = d * i +} + +protected[duration] class LongMult(i: Long) { + def *(d: Duration) = d * i +} + +protected[duration] class DoubleMult(f: Double) { + def *(d: Duration) = d * f +} diff --git a/src/library/scala/concurrent/util/duration/package.scala b/src/library/scala/concurrent/duration/package.scala index d5ae3f1544..31f222c3a2 100644 --- a/src/library/scala/concurrent/util/duration/package.scala +++ b/src/library/scala/concurrent/duration/package.scala @@ -1,4 +1,4 @@ -package scala.concurrent.util +package scala.concurrent import java.util.concurrent.TimeUnit import scala.language.implicitConversions diff --git a/src/library/scala/concurrent/impl/Promise.scala b/src/library/scala/concurrent/impl/Promise.scala index 9228872f2b..99c274dc29 100644 --- a/src/library/scala/concurrent/impl/Promise.scala +++ b/src/library/scala/concurrent/impl/Promise.scala @@ -12,7 +12,7 @@ package scala.concurrent.impl import java.util.concurrent.TimeUnit.NANOSECONDS import scala.concurrent.{ ExecutionContext, CanAwait, OnCompleteRunnable, TimeoutException, ExecutionException } -import scala.concurrent.util.{ Duration, Deadline, FiniteDuration } +import scala.concurrent.duration.{ Duration, Deadline, FiniteDuration } import scala.annotation.tailrec import scala.util.control.NonFatal import scala.util.{ Try, Success, Failure } diff --git a/src/library/scala/concurrent/package.scala b/src/library/scala/concurrent/package.scala index 1d06341d4d..e683732e41 100644 --- a/src/library/scala/concurrent/package.scala +++ b/src/library/scala/concurrent/package.scala @@ -8,7 +8,7 @@ package scala -import scala.concurrent.util.Duration +import scala.concurrent.duration.Duration import scala.annotation.implicitNotFound /** This package object contains primitives for concurrent and parallel programming. diff --git a/src/library/scala/concurrent/util/duration/Classifier.scala b/src/library/scala/concurrent/util/duration/Classifier.scala deleted file mode 100644 index 10faf0a5ce..0000000000 --- a/src/library/scala/concurrent/util/duration/Classifier.scala +++ /dev/null @@ -1,9 +0,0 @@ -package scala.concurrent.util.duration - -import scala.concurrent.util.{ FiniteDuration } - -trait Classifier[C] { - type R - def convert(d: FiniteDuration): R -} - diff --git a/src/library/scala/concurrent/util/duration/IntMult.scala b/src/library/scala/concurrent/util/duration/IntMult.scala deleted file mode 100644 index 94c58fb8c2..0000000000 --- a/src/library/scala/concurrent/util/duration/IntMult.scala +++ /dev/null @@ -1,18 +0,0 @@ -package scala.concurrent.util.duration - -import scala.concurrent.util.{ Duration } - -/* - * Avoid reflection based invocation by using non-duck type - */ -protected[duration] class IntMult(i: Int) { - def *(d: Duration) = d * i -} - -protected[duration] class LongMult(i: Long) { - def *(d: Duration) = d * i -} - -protected[duration] class DoubleMult(f: Double) { - def *(d: Duration) = d * f -} diff --git a/test/files/jvm/actmig-PinS.scala b/test/files/jvm/actmig-PinS.scala index 39f8f04b3b..30307f3737 100644 --- a/test/files/jvm/actmig-PinS.scala +++ b/test/files/jvm/actmig-PinS.scala @@ -1,5 +1,5 @@ import scala.actors._ -import scala.concurrent.util.duration._ +import scala.concurrent.duration._ import scala.concurrent.{ Promise, Await } import scala.actors.Actor._ diff --git a/test/files/jvm/actmig-PinS_1.scala b/test/files/jvm/actmig-PinS_1.scala index 1fb50567b9..640684f728 100644 --- a/test/files/jvm/actmig-PinS_1.scala +++ b/test/files/jvm/actmig-PinS_1.scala @@ -1,5 +1,5 @@ import scala.actors._ -import scala.concurrent.util.duration._ +import scala.concurrent.duration._ import scala.concurrent.{ Promise, Await } object SillyActor { diff --git a/test/files/jvm/actmig-PinS_2.scala b/test/files/jvm/actmig-PinS_2.scala index 46277efd43..761df6b5a7 100644 --- a/test/files/jvm/actmig-PinS_2.scala +++ b/test/files/jvm/actmig-PinS_2.scala @@ -1,5 +1,5 @@ import scala.actors.{ MigrationSystem, StashingActor, ActorRef, Props, Exit } -import scala.concurrent.util.duration._ +import scala.concurrent.duration._ import scala.concurrent.{ Promise, Await } object SillyActor { diff --git a/test/files/jvm/actmig-PinS_3.scala b/test/files/jvm/actmig-PinS_3.scala index 321e99b1c2..de9788724d 100644 --- a/test/files/jvm/actmig-PinS_3.scala +++ b/test/files/jvm/actmig-PinS_3.scala @@ -1,5 +1,5 @@ import scala.actors.{ MigrationSystem, StashingActor, ActorRef, Terminated, Props } -import scala.concurrent.util.duration._ +import scala.concurrent.duration._ import scala.concurrent.{ Promise, Await } diff --git a/test/files/jvm/actmig-public-methods_1.scala b/test/files/jvm/actmig-public-methods_1.scala index 7e5bc24210..4bbdc9a71f 100644 --- a/test/files/jvm/actmig-public-methods_1.scala +++ b/test/files/jvm/actmig-public-methods_1.scala @@ -3,7 +3,7 @@ import scala.actors.Actor._ import scala.actors._ import scala.util._ import java.util.concurrent.{ TimeUnit, CountDownLatch } -import scala.concurrent.util.Duration +import scala.concurrent.duration.Duration import scala.actors.pattern._ object Test { diff --git a/test/files/jvm/actmig-react-receive.scala b/test/files/jvm/actmig-react-receive.scala index 8464a2af79..280582511f 100644 --- a/test/files/jvm/actmig-react-receive.scala +++ b/test/files/jvm/actmig-react-receive.scala @@ -3,7 +3,7 @@ import scala.actors.Actor._ import scala.actors.{ Actor, StashingActor, ActorRef, Props, MigrationSystem, PoisonPill } import java.util.concurrent.{ TimeUnit, CountDownLatch } import scala.collection.mutable.ArrayBuffer -import scala.concurrent.util.duration._ +import scala.concurrent.duration._ import scala.concurrent.{ Promise, Await } object Test { diff --git a/test/files/jvm/duration-java/Test.java b/test/files/jvm/duration-java/Test.java index 1c53ccb266..94f3f83db8 100644 --- a/test/files/jvm/duration-java/Test.java +++ b/test/files/jvm/duration-java/Test.java @@ -1,4 +1,4 @@ -import scala.concurrent.util.Duration; +import scala.concurrent.duration.Duration; import java.util.*; import java.util.concurrent.TimeUnit; import static java.util.concurrent.TimeUnit.*; diff --git a/test/files/jvm/duration-tck.scala b/test/files/jvm/duration-tck.scala index c5dbe2e133..1a09007dc9 100644 --- a/test/files/jvm/duration-tck.scala +++ b/test/files/jvm/duration-tck.scala @@ -2,8 +2,7 @@ * Copyright (C) 2012 Typesafe Inc. <http://www.typesafe.com> */ -import scala.concurrent.util._ -import duration._ +import scala.concurrent.duration._ import scala.reflect._ import java.util.concurrent.TimeUnit._ import scala.tools.partest.TestUtil.intercept diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala index 31bb8c4e44..8674be168c 100644 --- a/test/files/jvm/future-spec/FutureTests.scala +++ b/test/files/jvm/future-spec/FutureTests.scala @@ -2,8 +2,8 @@ import scala.concurrent._ -import scala.concurrent.util.duration._ -import scala.concurrent.util.Duration.Inf +import scala.concurrent.duration._ +import scala.concurrent.duration.Duration.Inf import scala.collection._ import scala.runtime.NonLocalReturnControl import scala.util.{Try,Success,Failure} diff --git a/test/files/jvm/future-spec/PromiseTests.scala b/test/files/jvm/future-spec/PromiseTests.scala index d9aaa1d5ed..8e07393900 100644 --- a/test/files/jvm/future-spec/PromiseTests.scala +++ b/test/files/jvm/future-spec/PromiseTests.scala @@ -2,8 +2,8 @@ import scala.concurrent._ -import scala.concurrent.util.duration._ -import scala.concurrent.util.Duration.Inf +import scala.concurrent.duration._ +import scala.concurrent.duration.Duration.Inf import scala.collection._ import scala.runtime.NonLocalReturnControl import scala.util.{Try,Success,Failure} diff --git a/test/files/jvm/future-spec/main.scala b/test/files/jvm/future-spec/main.scala index 57183d8cea..90048ccda0 100644 --- a/test/files/jvm/future-spec/main.scala +++ b/test/files/jvm/future-spec/main.scala @@ -3,7 +3,7 @@ import scala.collection._ import scala.concurrent._ -import scala.concurrent.util.Duration +import scala.concurrent.duration.Duration import java.util.concurrent.{ TimeoutException, CountDownLatch, TimeUnit } diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala index 0e76b711de..b529bca38a 100644 --- a/test/files/jvm/scala-concurrent-tck.scala +++ b/test/files/jvm/scala-concurrent-tck.scala @@ -10,7 +10,7 @@ import scala.concurrent.{ } import scala.concurrent.{ future, promise, blocking } import scala.util.{ Try, Success, Failure } -import scala.concurrent.util.Duration +import scala.concurrent.duration.Duration import scala.reflect.{ classTag, ClassTag } import scala.tools.partest.TestUtil.intercept diff --git a/test/files/neg/deadline-inf-illegal.check b/test/files/neg/deadline-inf-illegal.check index 2b9b25e48e..530d2b2443 100644 --- a/test/files/neg/deadline-inf-illegal.check +++ b/test/files/neg/deadline-inf-illegal.check @@ -1,15 +1,15 @@ -deadline-inf-illegal.scala:5: error: value fromNow is not a member of scala.concurrent.util.Duration +deadline-inf-illegal.scala:5: error: value fromNow is not a member of scala.concurrent.duration.Duration d.fromNow ^ deadline-inf-illegal.scala:6: error: type mismatch; - found : scala.concurrent.util.Duration - required: scala.concurrent.util.FiniteDuration + found : scala.concurrent.duration.Duration + required: scala.concurrent.duration.FiniteDuration Deadline.now + d ^ deadline-inf-illegal.scala:7: error: overloaded method value - with alternatives: - (other: scala.concurrent.util.Deadline)scala.concurrent.util.FiniteDuration <and> - (other: scala.concurrent.util.FiniteDuration)scala.concurrent.util.Deadline - cannot be applied to (scala.concurrent.util.Duration) + (other: scala.concurrent.duration.Deadline)scala.concurrent.duration.FiniteDuration <and> + (other: scala.concurrent.duration.FiniteDuration)scala.concurrent.duration.Deadline + cannot be applied to (scala.concurrent.duration.Duration) Deadline.now - d ^ three errors found diff --git a/test/files/neg/deadline-inf-illegal.scala b/test/files/neg/deadline-inf-illegal.scala index 161089bfee..942cea7014 100644 --- a/test/files/neg/deadline-inf-illegal.scala +++ b/test/files/neg/deadline-inf-illegal.scala @@ -1,4 +1,4 @@ -import concurrent.util.{ Deadline, Duration } +import concurrent.duration.{ Deadline, Duration } class T { val d: Duration = Duration.Zero diff --git a/test/files/scalacheck/duration.scala b/test/files/scalacheck/duration.scala index 8037720f69..5e93638614 100644 --- a/test/files/scalacheck/duration.scala +++ b/test/files/scalacheck/duration.scala @@ -3,7 +3,7 @@ import Prop._ import Gen._ import Arbitrary._ import math._ -import concurrent.util.Duration.fromNanos +import concurrent.duration.Duration.fromNanos object Test extends Properties("Division of Duration by Long") { |