[K/N] Deprecated freezing ^KT-50541

Starting with 1.7.20 freezing is deprecated. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details.

Merge-request: KT-MR-6399
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
This commit is contained in:
Alexander Shabalin
2022-06-16 09:04:14 +00:00
committed by Space
parent b482b0e86d
commit 29f3445721
99 changed files with 321 additions and 68 deletions
@@ -6,7 +6,9 @@
package kotlin.collections
import kotlin.native.concurrent.isFrozen
import kotlin.native.FreezingIsDeprecated
@OptIn(FreezingIsDeprecated::class)
actual class HashMap<K, V> private constructor(
private var keysArray: Array<K>,
private var valuesArray: Array<V>?, // allocated only when actually used, always null in pure HashSet
@@ -0,0 +1,36 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.native
// This is here instead of kotlin-native/runtime because some of native-wasm uses this annotation.
/**
* Freezing API is deprecated since 1.7.20.
*
* See [NEW_MM.md#freezing-deprecation](https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation) for details
*/
// Note: when changing level of deprecation here, also change
// * `freezing` mode handling in KonanConfig.kt
// * frontend diagnostics in ErrorsNative.kt
@SinceKotlin("1.7")
@RequiresOptIn(
message = "Freezing API is deprecated since 1.7.20. See https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md#freezing-deprecation for details",
level = RequiresOptIn.Level.WARNING,
)
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.ANNOTATION_CLASS,
AnnotationTarget.PROPERTY,
AnnotationTarget.FIELD,
AnnotationTarget.LOCAL_VARIABLE,
AnnotationTarget.VALUE_PARAMETER,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.FUNCTION,
AnnotationTarget.PROPERTY_GETTER,
AnnotationTarget.PROPERTY_SETTER,
AnnotationTarget.TYPEALIAS,
)
@Retention(AnnotationRetention.BINARY)
actual annotation class FreezingIsDeprecated
@@ -27,6 +27,7 @@ import kotlin.collections.associate
import kotlin.native.concurrent.AtomicReference
import kotlin.native.concurrent.freeze
import kotlin.native.BitSet
import kotlin.native.FreezingIsDeprecated
/**
* Unicode category (i.e. Ll, Lu).
@@ -48,6 +49,7 @@ internal class UnicodeCategoryScope(category: Int) : UnicodeCategory(category) {
* This class represents character classes, i.e. sets of character either predefined or user defined.
* Note: this class represent a token, not node, so being constructed by lexer.
*/
@OptIn(FreezingIsDeprecated::class)
internal abstract class AbstractCharClass : SpecialToken() {
/**
* Show if the class has alternative meaning: