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
This commit is contained in:
Stanislav Erokhin
2022-07-05 17:18:26 +02:00
committed by teamcity
parent 509ed69d28
commit d788a927c4
9 changed files with 32 additions and 30 deletions
+5 -3
View File
@@ -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