From d788a927c4dba94be67effdfd2458e9d4ff2e4f8 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Tue, 5 Jul 2022 17:18:26 +0200 Subject: [PATCH] Change deprecations annotation order on Ranges#endExclusive property We have [Int|Long|Char]Range classes in 2 different places: - as separate class-files - serialized in the kotlin_builtins file For some reason our Kotlin compiler during the JVM compilation re-arranging the order of the annotations, so in class file they will be written in the following order: - Deprecated - SinceKotlin - ExperimentalStdlibApi But in the kotlin_builtins they will be stored the same way as in the sources. We need these 2 way to be synchronized, because stub's in IDE cares about order. After this commit IDE test BuiltInDecompilerConsistencyTest is fixed --- .../testData/builtIns/kotlin-ranges.txt | 6 +++--- .../builtin-classes/default/kotlin-ranges.txt | 6 +++--- .../testData/builtin-classes/java6/kotlin-ranges.txt | 6 +++--- .../testData/builtin-classes/java8/kotlin-ranges.txt | 6 +++--- .../builtin-classes/newMethods/kotlin-ranges.txt | 6 +++--- generators/builtins/ranges.kt | 8 +++++--- libraries/stdlib/api/js-v1/kotlin.ranges.kt | 12 ++++++------ libraries/stdlib/api/js/kotlin.ranges.kt | 6 +++--- .../stdlib/src/kotlin/ranges/PrimitiveRanges.kt | 6 +++--- 9 files changed, 32 insertions(+), 30 deletions(-) diff --git a/compiler/fir/analysis-tests/testData/builtIns/kotlin-ranges.txt b/compiler/fir/analysis-tests/testData/builtIns/kotlin-ranges.txt index 17f1e74197c..402e948d237 100644 --- a/compiler/fir/analysis-tests/testData/builtIns/kotlin-ranges.txt +++ b/compiler/fir/analysis-tests/testData/builtIns/kotlin-ranges.txt @@ -71,7 +71,7 @@ public final class CharRange : R|kotlin/ranges/CharProgression|, R|kotlin/ranges public open fun toString(): R|kotlin/String| - @PROPERTY:R|kotlin/SinceKotlin|(version = String(1.7)) @PROPERTY:R|kotlin/ExperimentalStdlibApi|() @PROPERTY:R|kotlin/Deprecated|(message = String(Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.)) public open val endExclusive: R|kotlin/Char| + @PROPERTY:R|kotlin/Deprecated|(message = String(Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.)) @PROPERTY:R|kotlin/SinceKotlin|(version = String(1.7)) @PROPERTY:R|kotlin/ExperimentalStdlibApi|() public open val endExclusive: R|kotlin/Char| public get(): R|kotlin/Char| public open val endInclusive: R|kotlin/Char| @@ -170,7 +170,7 @@ public final class IntRange : R|kotlin/ranges/IntProgression|, R|kotlin/ranges/C public open fun toString(): R|kotlin/String| - @PROPERTY:R|kotlin/SinceKotlin|(version = String(1.7)) @PROPERTY:R|kotlin/ExperimentalStdlibApi|() @PROPERTY:R|kotlin/Deprecated|(message = String(Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.)) public open val endExclusive: R|kotlin/Int| + @PROPERTY:R|kotlin/Deprecated|(message = String(Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.)) @PROPERTY:R|kotlin/SinceKotlin|(version = String(1.7)) @PROPERTY:R|kotlin/ExperimentalStdlibApi|() public open val endExclusive: R|kotlin/Int| public get(): R|kotlin/Int| public open val endInclusive: R|kotlin/Int| @@ -256,7 +256,7 @@ public final class LongRange : R|kotlin/ranges/LongProgression|, R|kotlin/ranges public open fun toString(): R|kotlin/String| - @PROPERTY:R|kotlin/SinceKotlin|(version = String(1.7)) @PROPERTY:R|kotlin/ExperimentalStdlibApi|() @PROPERTY:R|kotlin/Deprecated|(message = String(Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.)) public open val endExclusive: R|kotlin/Long| + @PROPERTY:R|kotlin/Deprecated|(message = String(Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.)) @PROPERTY:R|kotlin/SinceKotlin|(version = String(1.7)) @PROPERTY:R|kotlin/ExperimentalStdlibApi|() public open val endExclusive: R|kotlin/Long| public get(): R|kotlin/Long| public open val endInclusive: R|kotlin/Long| diff --git a/compiler/testData/builtin-classes/default/kotlin-ranges.txt b/compiler/testData/builtin-classes/default/kotlin-ranges.txt index 4636fee282a..5cfe0b5eaf8 100644 --- a/compiler/testData/builtin-classes/default/kotlin-ranges.txt +++ b/compiler/testData/builtin-classes/default/kotlin-ranges.txt @@ -36,7 +36,7 @@ internal final class CharProgressionIterator : kotlin.collections.CharIterator { public final class CharRange : kotlin.ranges.CharProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor CharRange(/*0*/ start: kotlin.Char, /*1*/ endInclusive: kotlin.Char) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Char + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Char public open override /*1*/ fun ``(): kotlin.Char public open override /*1*/ val endInclusive: kotlin.Char public open override /*1*/ fun ``(): kotlin.Char @@ -104,7 +104,7 @@ internal final class IntProgressionIterator : kotlin.collections.IntIterator { public final class IntRange : kotlin.ranges.IntProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor IntRange(/*0*/ start: kotlin.Int, /*1*/ endInclusive: kotlin.Int) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Int + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Int public open override /*1*/ fun ``(): kotlin.Int public open override /*1*/ val endInclusive: kotlin.Int public open override /*1*/ fun ``(): kotlin.Int @@ -163,7 +163,7 @@ internal final class LongProgressionIterator : kotlin.collections.LongIterator { public final class LongRange : kotlin.ranges.LongProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor LongRange(/*0*/ start: kotlin.Long, /*1*/ endInclusive: kotlin.Long) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Long + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Long public open override /*1*/ fun ``(): kotlin.Long public open override /*1*/ val endInclusive: kotlin.Long public open override /*1*/ fun ``(): kotlin.Long diff --git a/compiler/testData/builtin-classes/java6/kotlin-ranges.txt b/compiler/testData/builtin-classes/java6/kotlin-ranges.txt index 4636fee282a..5cfe0b5eaf8 100644 --- a/compiler/testData/builtin-classes/java6/kotlin-ranges.txt +++ b/compiler/testData/builtin-classes/java6/kotlin-ranges.txt @@ -36,7 +36,7 @@ internal final class CharProgressionIterator : kotlin.collections.CharIterator { public final class CharRange : kotlin.ranges.CharProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor CharRange(/*0*/ start: kotlin.Char, /*1*/ endInclusive: kotlin.Char) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Char + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Char public open override /*1*/ fun ``(): kotlin.Char public open override /*1*/ val endInclusive: kotlin.Char public open override /*1*/ fun ``(): kotlin.Char @@ -104,7 +104,7 @@ internal final class IntProgressionIterator : kotlin.collections.IntIterator { public final class IntRange : kotlin.ranges.IntProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor IntRange(/*0*/ start: kotlin.Int, /*1*/ endInclusive: kotlin.Int) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Int + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Int public open override /*1*/ fun ``(): kotlin.Int public open override /*1*/ val endInclusive: kotlin.Int public open override /*1*/ fun ``(): kotlin.Int @@ -163,7 +163,7 @@ internal final class LongProgressionIterator : kotlin.collections.LongIterator { public final class LongRange : kotlin.ranges.LongProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor LongRange(/*0*/ start: kotlin.Long, /*1*/ endInclusive: kotlin.Long) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Long + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Long public open override /*1*/ fun ``(): kotlin.Long public open override /*1*/ val endInclusive: kotlin.Long public open override /*1*/ fun ``(): kotlin.Long diff --git a/compiler/testData/builtin-classes/java8/kotlin-ranges.txt b/compiler/testData/builtin-classes/java8/kotlin-ranges.txt index be8a550ab96..cea7f2a6350 100644 --- a/compiler/testData/builtin-classes/java8/kotlin-ranges.txt +++ b/compiler/testData/builtin-classes/java8/kotlin-ranges.txt @@ -39,7 +39,7 @@ internal final class CharProgressionIterator : kotlin.collections.CharIterator { public final class CharRange : kotlin.ranges.CharProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor CharRange(/*0*/ start: kotlin.Char, /*1*/ endInclusive: kotlin.Char) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Char + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Char public open override /*1*/ fun ``(): kotlin.Char public open override /*1*/ val endInclusive: kotlin.Char public open override /*1*/ fun ``(): kotlin.Char @@ -112,7 +112,7 @@ internal final class IntProgressionIterator : kotlin.collections.IntIterator { public final class IntRange : kotlin.ranges.IntProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor IntRange(/*0*/ start: kotlin.Int, /*1*/ endInclusive: kotlin.Int) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Int + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Int public open override /*1*/ fun ``(): kotlin.Int public open override /*1*/ val endInclusive: kotlin.Int public open override /*1*/ fun ``(): kotlin.Int @@ -176,7 +176,7 @@ internal final class LongProgressionIterator : kotlin.collections.LongIterator { public final class LongRange : kotlin.ranges.LongProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor LongRange(/*0*/ start: kotlin.Long, /*1*/ endInclusive: kotlin.Long) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Long + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Long public open override /*1*/ fun ``(): kotlin.Long public open override /*1*/ val endInclusive: kotlin.Long public open override /*1*/ fun ``(): kotlin.Long diff --git a/compiler/testData/builtin-classes/newMethods/kotlin-ranges.txt b/compiler/testData/builtin-classes/newMethods/kotlin-ranges.txt index 4636fee282a..5cfe0b5eaf8 100644 --- a/compiler/testData/builtin-classes/newMethods/kotlin-ranges.txt +++ b/compiler/testData/builtin-classes/newMethods/kotlin-ranges.txt @@ -36,7 +36,7 @@ internal final class CharProgressionIterator : kotlin.collections.CharIterator { public final class CharRange : kotlin.ranges.CharProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor CharRange(/*0*/ start: kotlin.Char, /*1*/ endInclusive: kotlin.Char) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Char + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Char public open override /*1*/ fun ``(): kotlin.Char public open override /*1*/ val endInclusive: kotlin.Char public open override /*1*/ fun ``(): kotlin.Char @@ -104,7 +104,7 @@ internal final class IntProgressionIterator : kotlin.collections.IntIterator { public final class IntRange : kotlin.ranges.IntProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor IntRange(/*0*/ start: kotlin.Int, /*1*/ endInclusive: kotlin.Int) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Int + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Int public open override /*1*/ fun ``(): kotlin.Int public open override /*1*/ val endInclusive: kotlin.Int public open override /*1*/ fun ``(): kotlin.Int @@ -163,7 +163,7 @@ internal final class LongProgressionIterator : kotlin.collections.LongIterator { public final class LongRange : kotlin.ranges.LongProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*primary*/ public constructor LongRange(/*0*/ start: kotlin.Long, /*1*/ endInclusive: kotlin.Long) - @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override /*1*/ val endExclusive: kotlin.Long + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi public open override /*1*/ val endExclusive: kotlin.Long public open override /*1*/ fun ``(): kotlin.Long public open override /*1*/ val endInclusive: kotlin.Long public open override /*1*/ fun ``(): kotlin.Long diff --git a/generators/builtins/ranges.kt b/generators/builtins/ranges.kt index 4e9f04564e8..1ef3d52d873 100644 --- a/generators/builtins/ranges.kt +++ b/generators/builtins/ranges.kt @@ -16,9 +16,11 @@ package org.jetbrains.kotlin.generators.builtins.ranges -import org.jetbrains.kotlin.generators.builtins.* -import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.* +import org.jetbrains.kotlin.generators.builtins.ProgressionKind import org.jetbrains.kotlin.generators.builtins.ProgressionKind.* +import org.jetbrains.kotlin.generators.builtins.areEqualNumbers +import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.BuiltInsSourceGenerator +import org.jetbrains.kotlin.generators.builtins.hashLong import java.io.PrintWriter class GenerateRanges(out: PrintWriter) : BuiltInsSourceGenerator(out) { @@ -57,9 +59,9 @@ public class $range(start: $t, endInclusive: $t) : ${t}Progression(start, endInc override val start: $t get() = first override val endInclusive: $t get() = last + @Deprecated("Can throw an exception when it's impossible to represent the value with $t type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @SinceKotlin("1.7") @ExperimentalStdlibApi - @Deprecated("Can throw an exception when it's impossible to represent the value with $t type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") override val endExclusive: $t get() { if (last == $t.MAX_VALUE) error("Cannot return the exclusive upper bound of a range that includes MAX_VALUE.") return last + 1 diff --git a/libraries/stdlib/api/js-v1/kotlin.ranges.kt b/libraries/stdlib/api/js-v1/kotlin.ranges.kt index 5bdcb875d64..844c9553073 100644 --- a/libraries/stdlib/api/js-v1/kotlin.ranges.kt +++ b/libraries/stdlib/api/js-v1/kotlin.ranges.kt @@ -809,9 +809,9 @@ public open class CharProgression : kotlin.collections.Iterable { public final class CharRange : kotlin.ranges.CharProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { public constructor CharRange(start: kotlin.Char, endInclusive: kotlin.Char) + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi - @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override val endExclusive: kotlin.Char { get; } public open override val endInclusive: kotlin.Char { get; } @@ -836,9 +836,9 @@ public final class CharRange : kotlin.ranges.CharProgression, kotlin.ranges.Clos /*∆*/ public final class CharRange : kotlin.ranges.CharProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*∆*/ public constructor CharRange(start: kotlin.Char, endInclusive: kotlin.Char) /*∆*/ +/*∆*/ @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") /*∆*/ @kotlin.SinceKotlin(version = "1.7") /*∆*/ @kotlin.ExperimentalStdlibApi -/*∆*/ @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") /*∆*/ public open override val endExclusive: kotlin.Char { get; } /*∆*/ /*∆*/ public open override val endInclusive: kotlin.Char { get; } @@ -936,9 +936,9 @@ public open class IntProgression : kotlin.collections.Iterable { public final class IntRange : kotlin.ranges.IntProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { public constructor IntRange(start: kotlin.Int, endInclusive: kotlin.Int) + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi - @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override val endExclusive: kotlin.Int { get; } public open override val endInclusive: kotlin.Int { get; } @@ -963,9 +963,9 @@ public final class IntRange : kotlin.ranges.IntProgression, kotlin.ranges.Closed /*∆*/ public final class IntRange : kotlin.ranges.IntProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*∆*/ public constructor IntRange(start: kotlin.Int, endInclusive: kotlin.Int) /*∆*/ +/*∆*/ @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") /*∆*/ @kotlin.SinceKotlin(version = "1.7") /*∆*/ @kotlin.ExperimentalStdlibApi -/*∆*/ @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") /*∆*/ public open override val endExclusive: kotlin.Int { get; } /*∆*/ /*∆*/ public open override val endInclusive: kotlin.Int { get; } @@ -1034,9 +1034,9 @@ public open class LongProgression : kotlin.collections.Iterable { public final class LongRange : kotlin.ranges.LongProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { public constructor LongRange(start: kotlin.Long, endInclusive: kotlin.Long) + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi - @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override val endExclusive: kotlin.Long { get; } public open override val endInclusive: kotlin.Long { get; } @@ -1061,9 +1061,9 @@ public final class LongRange : kotlin.ranges.LongProgression, kotlin.ranges.Clos /*∆*/ public final class LongRange : kotlin.ranges.LongProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { /*∆*/ public constructor LongRange(start: kotlin.Long, endInclusive: kotlin.Long) /*∆*/ +/*∆*/ @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") /*∆*/ @kotlin.SinceKotlin(version = "1.7") /*∆*/ @kotlin.ExperimentalStdlibApi -/*∆*/ @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") /*∆*/ public open override val endExclusive: kotlin.Long { get; } /*∆*/ /*∆*/ public open override val endInclusive: kotlin.Long { get; } diff --git a/libraries/stdlib/api/js/kotlin.ranges.kt b/libraries/stdlib/api/js/kotlin.ranges.kt index ae262881c88..f034aefcbe2 100644 --- a/libraries/stdlib/api/js/kotlin.ranges.kt +++ b/libraries/stdlib/api/js/kotlin.ranges.kt @@ -787,9 +787,9 @@ public open class CharProgression : kotlin.collections.Iterable { public final class CharRange : kotlin.ranges.CharProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { public constructor CharRange(start: kotlin.Char, endInclusive: kotlin.Char) + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi - @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override val endExclusive: kotlin.Char { get; } public open override val endInclusive: kotlin.Char { get; } @@ -855,9 +855,9 @@ public open class IntProgression : kotlin.collections.Iterable { public final class IntRange : kotlin.ranges.IntProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { public constructor IntRange(start: kotlin.Int, endInclusive: kotlin.Int) + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi - @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override val endExclusive: kotlin.Int { get; } public open override val endInclusive: kotlin.Int { get; } @@ -904,9 +904,9 @@ public open class LongProgression : kotlin.collections.Iterable { public final class LongRange : kotlin.ranges.LongProgression, kotlin.ranges.ClosedRange, kotlin.ranges.OpenEndRange { public constructor LongRange(start: kotlin.Long, endInclusive: kotlin.Long) + @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @kotlin.SinceKotlin(version = "1.7") @kotlin.ExperimentalStdlibApi - @kotlin.Deprecated(message = "Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") public open override val endExclusive: kotlin.Long { get; } public open override val endInclusive: kotlin.Long { get; } diff --git a/libraries/stdlib/src/kotlin/ranges/PrimitiveRanges.kt b/libraries/stdlib/src/kotlin/ranges/PrimitiveRanges.kt index 3f01dce480d..cf06b2026d6 100644 --- a/libraries/stdlib/src/kotlin/ranges/PrimitiveRanges.kt +++ b/libraries/stdlib/src/kotlin/ranges/PrimitiveRanges.kt @@ -15,9 +15,9 @@ public class CharRange(start: Char, endInclusive: Char) : CharProgression(start, override val start: Char get() = first override val endInclusive: Char get() = last + @Deprecated("Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @SinceKotlin("1.7") @ExperimentalStdlibApi - @Deprecated("Can throw an exception when it's impossible to represent the value with Char type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") override val endExclusive: Char get() { if (last == Char.MAX_VALUE) error("Cannot return the exclusive upper bound of a range that includes MAX_VALUE.") return last + 1 @@ -55,9 +55,9 @@ public class IntRange(start: Int, endInclusive: Int) : IntProgression(start, end override val start: Int get() = first override val endInclusive: Int get() = last + @Deprecated("Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @SinceKotlin("1.7") @ExperimentalStdlibApi - @Deprecated("Can throw an exception when it's impossible to represent the value with Int type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") override val endExclusive: Int get() { if (last == Int.MAX_VALUE) error("Cannot return the exclusive upper bound of a range that includes MAX_VALUE.") return last + 1 @@ -95,9 +95,9 @@ public class LongRange(start: Long, endInclusive: Long) : LongProgression(start, override val start: Long get() = first override val endInclusive: Long get() = last + @Deprecated("Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") @SinceKotlin("1.7") @ExperimentalStdlibApi - @Deprecated("Can throw an exception when it's impossible to represent the value with Long type, for example, when the range includes MAX_VALUE. It's recommended to use 'endInclusive' property that doesn't throw.") override val endExclusive: Long get() { if (last == Long.MAX_VALUE) error("Cannot return the exclusive upper bound of a range that includes MAX_VALUE.") return last + 1