From 9c4a2d44317437ff1f89ff37bbfcbcbaaf9daf96 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 5 Oct 2021 21:15:50 +0300 Subject: [PATCH] Leave all deprecated duration API experimental KT-46784 --- libraries/stdlib/api/js-v1/kotlin.time.kt | 9 +++++++++ libraries/stdlib/api/js/kotlin.time.kt | 9 +++++++++ libraries/stdlib/src/kotlin/time/Duration.kt | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/libraries/stdlib/api/js-v1/kotlin.time.kt b/libraries/stdlib/api/js-v1/kotlin.time.kt index 620b45c6640..e4031dec883 100644 --- a/libraries/stdlib/api/js-v1/kotlin.time.kt +++ b/libraries/stdlib/api/js-v1/kotlin.time.kt @@ -204,24 +204,31 @@ public abstract class AbstractLongTimeSource : kotlin.time.TimeSource { public final inline class Duration : kotlin.Comparable { public final val absoluteValue: kotlin.time.Duration { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeDays property instead or convert toDouble(DAYS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.DAYS)", imports = {})) public final val inDays: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeHours property instead or convert toDouble(HOURS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.HOURS)", imports = {})) public final val inHours: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeMicroseconds property instead or convert toDouble(MICROSECONDS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.MICROSECONDS)", imports = {})) public final val inMicroseconds: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeMilliseconds property instead or convert toDouble(MILLISECONDS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.MILLISECONDS)", imports = {})) public final val inMilliseconds: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeMinutes property instead or convert toDouble(MINUTES) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.MINUTES)", imports = {})) public final val inMinutes: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeNanoseconds property instead or convert toDouble(NANOSECONDS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.NANOSECONDS)", imports = {})) public final val inNanoseconds: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeSeconds property instead or convert toDouble(SECONDS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.SECONDS)", imports = {})) public final val inSeconds: kotlin.Double { get; } @@ -283,9 +290,11 @@ public final inline class Duration : kotlin.Comparable { public final fun toLong(unit: kotlin.time.DurationUnit): kotlin.Long + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeMilliseconds property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.inWholeMilliseconds", imports = {})) public final fun toLongMilliseconds(): kotlin.Long + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeNanoseconds property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.inWholeNanoseconds", imports = {})) public final fun toLongNanoseconds(): kotlin.Long diff --git a/libraries/stdlib/api/js/kotlin.time.kt b/libraries/stdlib/api/js/kotlin.time.kt index 620b45c6640..e4031dec883 100644 --- a/libraries/stdlib/api/js/kotlin.time.kt +++ b/libraries/stdlib/api/js/kotlin.time.kt @@ -204,24 +204,31 @@ public abstract class AbstractLongTimeSource : kotlin.time.TimeSource { public final inline class Duration : kotlin.Comparable { public final val absoluteValue: kotlin.time.Duration { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeDays property instead or convert toDouble(DAYS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.DAYS)", imports = {})) public final val inDays: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeHours property instead or convert toDouble(HOURS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.HOURS)", imports = {})) public final val inHours: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeMicroseconds property instead or convert toDouble(MICROSECONDS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.MICROSECONDS)", imports = {})) public final val inMicroseconds: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeMilliseconds property instead or convert toDouble(MILLISECONDS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.MILLISECONDS)", imports = {})) public final val inMilliseconds: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeMinutes property instead or convert toDouble(MINUTES) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.MINUTES)", imports = {})) public final val inMinutes: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeNanoseconds property instead or convert toDouble(NANOSECONDS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.NANOSECONDS)", imports = {})) public final val inNanoseconds: kotlin.Double { get; } + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeSeconds property instead or convert toDouble(SECONDS) if a double value is required.", replaceWith = kotlin.ReplaceWith(expression = "toDouble(DurationUnit.SECONDS)", imports = {})) public final val inSeconds: kotlin.Double { get; } @@ -283,9 +290,11 @@ public final inline class Duration : kotlin.Comparable { public final fun toLong(unit: kotlin.time.DurationUnit): kotlin.Long + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeMilliseconds property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.inWholeMilliseconds", imports = {})) public final fun toLongMilliseconds(): kotlin.Long + @kotlin.time.ExperimentalTime @kotlin.Deprecated(message = "Use inWholeNanoseconds property instead.", replaceWith = kotlin.ReplaceWith(expression = "this.inWholeNanoseconds", imports = {})) public final fun toLongNanoseconds(): kotlin.Long diff --git a/libraries/stdlib/src/kotlin/time/Duration.kt b/libraries/stdlib/src/kotlin/time/Duration.kt index e557c26fb34..f9fb350348d 100644 --- a/libraries/stdlib/src/kotlin/time/Duration.kt +++ b/libraries/stdlib/src/kotlin/time/Duration.kt @@ -760,30 +760,37 @@ public value class Duration internal constructor(private val rawValue: Long) : C toLong(unit).coerceIn(Int.MIN_VALUE.toLong(), Int.MAX_VALUE.toLong()).toInt() /** The value of this duration expressed as a [Double] number of days. */ + @ExperimentalTime @Deprecated("Use inWholeDays property instead or convert toDouble(DAYS) if a double value is required.", ReplaceWith("toDouble(DurationUnit.DAYS)")) public val inDays: Double get() = toDouble(DurationUnit.DAYS) /** The value of this duration expressed as a [Double] number of hours. */ + @ExperimentalTime @Deprecated("Use inWholeHours property instead or convert toDouble(HOURS) if a double value is required.", ReplaceWith("toDouble(DurationUnit.HOURS)")) public val inHours: Double get() = toDouble(DurationUnit.HOURS) /** The value of this duration expressed as a [Double] number of minutes. */ + @ExperimentalTime @Deprecated("Use inWholeMinutes property instead or convert toDouble(MINUTES) if a double value is required.", ReplaceWith("toDouble(DurationUnit.MINUTES)")) public val inMinutes: Double get() = toDouble(DurationUnit.MINUTES) /** The value of this duration expressed as a [Double] number of seconds. */ + @ExperimentalTime @Deprecated("Use inWholeSeconds property instead or convert toDouble(SECONDS) if a double value is required.", ReplaceWith("toDouble(DurationUnit.SECONDS)")) public val inSeconds: Double get() = toDouble(DurationUnit.SECONDS) /** The value of this duration expressed as a [Double] number of milliseconds. */ + @ExperimentalTime @Deprecated("Use inWholeMilliseconds property instead or convert toDouble(MILLISECONDS) if a double value is required.", ReplaceWith("toDouble(DurationUnit.MILLISECONDS)")) public val inMilliseconds: Double get() = toDouble(DurationUnit.MILLISECONDS) /** The value of this duration expressed as a [Double] number of microseconds. */ + @ExperimentalTime @Deprecated("Use inWholeMicroseconds property instead or convert toDouble(MICROSECONDS) if a double value is required.", ReplaceWith("toDouble(DurationUnit.MICROSECONDS)")) public val inMicroseconds: Double get() = toDouble(DurationUnit.MICROSECONDS) /** The value of this duration expressed as a [Double] number of nanoseconds. */ + @ExperimentalTime @Deprecated("Use inWholeNanoseconds property instead or convert toDouble(NANOSECONDS) if a double value is required.", ReplaceWith("toDouble(DurationUnit.NANOSECONDS)")) public val inNanoseconds: Double get() = toDouble(DurationUnit.NANOSECONDS) @@ -871,6 +878,7 @@ public value class Duration internal constructor(private val rawValue: Long) : C * * The range of durations that can be expressed as a `Long` number of nanoseconds is approximately ±292 years. */ + @ExperimentalTime @Deprecated("Use inWholeNanoseconds property instead.", ReplaceWith("this.inWholeNanoseconds")) public fun toLongNanoseconds(): Long = inWholeNanoseconds @@ -881,6 +889,7 @@ public value class Duration internal constructor(private val rawValue: Long) : C * * The range of durations that can be expressed as a `Long` number of milliseconds is approximately ±292 million years. */ + @ExperimentalTime @Deprecated("Use inWholeMilliseconds property instead.", ReplaceWith("this.inWholeMilliseconds")) public fun toLongMilliseconds(): Long = inWholeMilliseconds