Change JS AbstractMutableCollection.toJSON() visibility modifier from open to protected
This commit is contained in:
committed by
Space
parent
a90117faa2
commit
a3eaa3e0f9
@@ -10296,8 +10296,9 @@ public abstract class AbstractMutableCollection<E> : kotlin.collections.Abstract
|
||||
|
||||
public open override fun retainAll(elements: kotlin.collections.Collection<E>): kotlin.Boolean
|
||||
|
||||
@kotlin.Deprecated(level = DeprecationLevel.HIDDEN, message = "Provided so that subclasses inherit this function")
|
||||
@kotlin.js.JsName(name = "toJSON")
|
||||
public open fun toJSON(): kotlin.Any
|
||||
protected final fun toJSON(): kotlin.Any
|
||||
}
|
||||
|
||||
public abstract class AbstractMutableList<E> : kotlin.collections.AbstractMutableCollection<E>, kotlin.collections.MutableList<E> {
|
||||
|
||||
@@ -10260,8 +10260,9 @@ public abstract class AbstractMutableCollection<E> : kotlin.collections.Abstract
|
||||
|
||||
public open override fun retainAll(elements: kotlin.collections.Collection<E>): kotlin.Boolean
|
||||
|
||||
@kotlin.Deprecated(level = DeprecationLevel.HIDDEN, message = "Provided so that subclasses inherit this function")
|
||||
@kotlin.js.JsName(name = "toJSON")
|
||||
public open fun toJSON(): kotlin.Any
|
||||
protected final fun toJSON(): kotlin.Any
|
||||
}
|
||||
|
||||
public abstract class AbstractMutableList<E> : kotlin.collections.AbstractMutableCollection<E>, kotlin.collections.MutableList<E> {
|
||||
|
||||
@@ -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>)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user