[STDLIB] 1/2 Drop AllowDifferentMembersInActual from stdlib
^KT-62656 Fixed I blindly converted all `@AllowDifferentMembersInActual` to suppresses. But some suppresses in stdlib are redundant. I'm too lazy properly annotate only the necessary places. All these suppresses will go away after the bootstrap update anyway I drop allowDifferentMembersInActual_class and allowDifferentMembersInActual_typealias tests because their only purpose was to check that `@AllowDifferentMembersInActual` works as expected Note: some tests are failing in the compiler because of that. I will fix them in the next commit
This commit is contained in:
@@ -12,7 +12,7 @@ package kotlin.collections
|
||||
*
|
||||
* @param E the type of elements contained in the collection. The collection is invariant in its element type.
|
||||
*/
|
||||
@AllowDifferentMembersInActual // New 'checkIsMutable', 'toJSON', etc. members are added compared to the expect declaration
|
||||
@Suppress("ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING", "ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING") // Can be dropped after bootstrap update
|
||||
public actual abstract class AbstractMutableCollection<E> protected actual constructor() : AbstractCollection<E>(), MutableCollection<E> {
|
||||
|
||||
actual abstract override fun add(element: E): Boolean
|
||||
@@ -57,6 +57,7 @@ public actual abstract class AbstractMutableCollection<E> protected actual const
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING") // Can be dropped after bootstrap update
|
||||
@Deprecated("Provided so that subclasses inherit this function", level = DeprecationLevel.HIDDEN)
|
||||
@JsName("toJSON")
|
||||
protected fun toJSON(): Any = this.toArray()
|
||||
@@ -66,6 +67,7 @@ public actual abstract class AbstractMutableCollection<E> protected actual const
|
||||
* This method is called every time when a mutating method is called on this mutable collection.
|
||||
* Mutable collections that are built (frozen) must throw `UnsupportedOperationException`.
|
||||
*/
|
||||
@Suppress("NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING") // Can be dropped after bootstrap update
|
||||
internal open fun checkIsMutable(): Unit { }
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,12 @@ package kotlin.collections
|
||||
*
|
||||
* @param E the type of elements contained in the list. The list is invariant in its element type.
|
||||
*/
|
||||
@AllowDifferentMembersInActual // New 'removeRange', 'checkIsMutable', etc. members are added compared to the expect declaration
|
||||
@Suppress(
|
||||
"ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING",
|
||||
"ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING"
|
||||
) // Can be dropped after bootstrap update
|
||||
public actual abstract class AbstractMutableList<E> protected actual constructor() : AbstractMutableCollection<E>(), MutableList<E> {
|
||||
@Suppress("NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING") // Can be dropped after bootstrap update
|
||||
protected var modCount: Int = 0
|
||||
|
||||
abstract override fun add(index: Int, element: E): Unit
|
||||
@@ -82,6 +86,7 @@ public actual abstract class AbstractMutableList<E> protected actual constructor
|
||||
/**
|
||||
* Removes the range of elements from this list starting from [fromIndex] and ending with but not including [toIndex].
|
||||
*/
|
||||
@Suppress("NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING") // Can be dropped after bootstrap update
|
||||
protected open fun removeRange(fromIndex: Int, toIndex: Int) {
|
||||
val iterator = listIterator(fromIndex)
|
||||
repeat(toIndex - fromIndex) {
|
||||
|
||||
@@ -18,10 +18,12 @@ package kotlin.collections
|
||||
* @param K the type of map keys. The map is invariant in its key type.
|
||||
* @param V the type of map values. The map is invariant in its value type.
|
||||
*/
|
||||
@AllowDifferentMembersInActual // New 'createKeysView', 'checkIsMutable', etc. members are added compared to the expect declaration
|
||||
@Suppress("ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING", "ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING") // Can be dropped after bootstrap update
|
||||
public actual abstract class AbstractMutableMap<K, V> protected actual constructor() : AbstractMap<K, V>(), MutableMap<K, V> {
|
||||
|
||||
@Suppress("NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING") // Can be dropped after bootstrap update
|
||||
internal open fun createKeysView(): MutableSet<K> = HashMapKeysDefault(this)
|
||||
@Suppress("NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING") // Can be dropped after bootstrap update
|
||||
internal open fun createValuesView(): MutableCollection<V> = HashMapValuesDefault(this)
|
||||
|
||||
private var keysView: MutableSet<K>? = null
|
||||
@@ -66,5 +68,6 @@ public actual abstract class AbstractMutableMap<K, V> protected actual construct
|
||||
* This method is called every time when a mutating method is called on this mutable map.
|
||||
* Mutable maps that are built (frozen) must throw `UnsupportedOperationException`.
|
||||
*/
|
||||
@Suppress("NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING") // Can be dropped after bootstrap update
|
||||
internal open fun checkIsMutable() {}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package kotlin.collections
|
||||
*
|
||||
* @param E the type of elements contained in the set. The set is invariant in its element type.
|
||||
*/
|
||||
@AllowDifferentMembersInActual // New 'AbstractMutableCollection` supertype is added compared to the expect declaration
|
||||
@Suppress("ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING", "ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER_WARNING") // Can be dropped after bootstrap update
|
||||
public actual abstract class AbstractMutableSet<E> protected actual constructor() : AbstractMutableCollection<E>(), MutableSet<E> {
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user