Change JS AbstractMutableCollection.toJSON() visibility modifier from open to protected

This commit is contained in:
Abduqodiri Qurbonzoda
2021-09-01 11:23:39 +03:00
committed by Space
parent a90117faa2
commit a3eaa3e0f9
4 changed files with 25 additions and 3 deletions
@@ -54,8 +54,9 @@ public actual abstract class AbstractMutableCollection<E> protected actual const
}
}
@Deprecated("Provided so that subclasses inherit this function", level = DeprecationLevel.HIDDEN)
@JsName("toJSON")
open fun toJSON(): Any = this.toArray()
protected fun toJSON(): Any = this.toArray()
/**
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2021 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 test.collections.js
import kotlin.test.*
class CollectionsJsTest {
@Test
fun toJSON() {
val list = arrayListOf("array", "List", "Of")
assertContentEquals(arrayOf("array", "List", "Of"), list.asDynamic().toJSON() as Array<String>)
val set = linkedSetOf("linked", "Set", "Of")
assertContentEquals(arrayOf("linked", "Set", "Of"), (set as AbstractMutableCollection<String>).asDynamic().toJSON() as Array<String>)
}
}