[K/N] Deprecate SharedImmutable annotation #KT-57837
As a part of efforts to stabilize Native stdlib.
This commit is contained in:
committed by
Space Team
parent
0cfb80144a
commit
4ae19b2b44
@@ -34,7 +34,6 @@ private fun FileWriter.writeCollection(
|
||||
append(strategy.indentation + string)
|
||||
}
|
||||
|
||||
append(strategy.rangesAnnotation)
|
||||
appendWithIndentation("${strategy.rangesVisibilityModifier} val $name = $constructingFun(")
|
||||
for (i in elements.indices) {
|
||||
if (i % 20 == 0) {
|
||||
|
||||
-1
@@ -54,7 +54,6 @@ internal class StringCasingTestGenerator(private val outputDir: File) {
|
||||
writer.appendLine()
|
||||
writer.appendLine("import kotlin.test.*")
|
||||
writer.appendLine()
|
||||
writer.appendLine("@SharedImmutable")
|
||||
writer.appendLine("private val $rangesArrayName = arrayOf<IntRange>(")
|
||||
ranges.forEach {
|
||||
writer.appendLine(" ${it.hexIntRangeLiteral()},")
|
||||
|
||||
+2
-5
@@ -12,7 +12,6 @@ import java.io.FileWriter
|
||||
|
||||
internal sealed class RangesWritingStrategy {
|
||||
abstract val indentation: String
|
||||
abstract val rangesAnnotation: String
|
||||
abstract val rangesVisibilityModifier: String
|
||||
abstract fun beforeWritingRanges(writer: FileWriter)
|
||||
abstract fun afterWritingRanges(writer: FileWriter)
|
||||
@@ -22,15 +21,14 @@ internal sealed class RangesWritingStrategy {
|
||||
fun of(target: KotlinTarget, wrapperName: String? = null): RangesWritingStrategy {
|
||||
return when (target.platform) {
|
||||
Platform.JS -> JsRangesWritingStrategy(wrapperName!!)
|
||||
else -> NativeRangesWritingStrategy(useNativeRangesAnnotation = target.backend != Backend.Wasm)
|
||||
else -> NativeRangesWritingStrategy
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class NativeRangesWritingStrategy(private val useNativeRangesAnnotation: Boolean) : RangesWritingStrategy() {
|
||||
internal object NativeRangesWritingStrategy : RangesWritingStrategy() {
|
||||
override val indentation: String get() = ""
|
||||
override val rangesAnnotation: String get() = if (useNativeRangesAnnotation) "@SharedImmutable\n" else ""
|
||||
override val rangesVisibilityModifier: String get() = "private"
|
||||
override fun beforeWritingRanges(writer: FileWriter) {}
|
||||
override fun afterWritingRanges(writer: FileWriter) {}
|
||||
@@ -42,7 +40,6 @@ internal class JsRangesWritingStrategy(
|
||||
private val wrapperName: String
|
||||
) : RangesWritingStrategy() {
|
||||
override val indentation: String get() = " ".repeat(4)
|
||||
override val rangesAnnotation: String get() = ""
|
||||
override val rangesVisibilityModifier: String get() = "internal"
|
||||
|
||||
override fun beforeWritingRanges(writer: FileWriter) {
|
||||
|
||||
Reference in New Issue
Block a user