diff options
author | Steven Scott <steven@codemettle.com> | 2015-02-06 12:06:38 -0500 |
---|---|---|
committer | Steven Scott <steven@codemettle.com> | 2015-02-06 15:08:11 -0500 |
commit | b690ef83c13dc04521fda7eea04db8aec6effa08 (patch) | |
tree | 53aa51cfc66613a2f39d88aee9c0e4fb0b6e0d17 /src | |
parent | 178e8df9b6a91375a6162721a0cbc2d90bcc7451 (diff) | |
download | scala-b690ef83c13dc04521fda7eea04db8aec6effa08.tar.gz scala-b690ef83c13dc04521fda7eea04db8aec6effa08.tar.bz2 scala-b690ef83c13dc04521fda7eea04db8aec6effa08.zip |
Declare FiniteDuration.toCoarsest to return a FiniteDuration
FiniteDuration.toCoarsest is declared with a return type of Duration
even though it can only ever return a FiniteDuration. Change the
declaration to return a FiniteDuration so that using this method
doesn't require a cast or pattern match on the result in cases where
a FiniteDuration is required.
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/concurrent/duration/Duration.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/library/scala/concurrent/duration/Duration.scala b/src/library/scala/concurrent/duration/Duration.scala index 2eded9f060..3697950e2e 100644 --- a/src/library/scala/concurrent/duration/Duration.scala +++ b/src/library/scala/concurrent/duration/Duration.scala @@ -705,7 +705,7 @@ final class FiniteDuration(val length: Long, val unit: TimeUnit) extends Duratio final def isFinite() = true - final def toCoarsest: Duration = { + final override def toCoarsest: FiniteDuration = { def loop(length: Long, unit: TimeUnit): FiniteDuration = { def coarserOrThis(coarser: TimeUnit, divider: Int) = if (length % divider == 0) loop(length / divider, coarser) |