From 9d2092e86dddc1b5395cea32d437e798f876f710 Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Mon, 28 May 2018 22:29:36 +0300 Subject: [PATCH] Fix visibility of `@JsName`-annotated symbols in stdlib-js --- libraries/stdlib/js/src/kotlin/console.kt | 12 ++++++------ libraries/stdlib/js/src/kotlin/exceptionUtils.kt | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/stdlib/js/src/kotlin/console.kt b/libraries/stdlib/js/src/kotlin/console.kt index def80b82adb..f9ea7b7ff03 100644 --- a/libraries/stdlib/js/src/kotlin/console.kt +++ b/libraries/stdlib/js/src/kotlin/console.kt @@ -5,7 +5,7 @@ package kotlin.io -private abstract class BaseOutput { +internal abstract class BaseOutput { open fun println() { print("\n") } @@ -22,13 +22,13 @@ private abstract class BaseOutput { /** JsName used to make the declaration available outside of module to test it */ @JsName("NodeJsOutput") -private class NodeJsOutput(val outputStream: dynamic) : BaseOutput() { +internal class NodeJsOutput(val outputStream: dynamic) : BaseOutput() { override fun print(message: Any?) = outputStream.write(String(message)) } /** JsName used to make the declaration available outside of module to test it */ @JsName("OutputToConsoleLog") -private class OutputToConsoleLog : BaseOutput() { +internal class OutputToConsoleLog : BaseOutput() { override fun print(message: Any?) { console.log(message) } @@ -44,7 +44,7 @@ private class OutputToConsoleLog : BaseOutput() { /** JsName used to make the declaration available outside of module to test it and use at try.kotl.in */ @JsName("BufferedOutput") -private open class BufferedOutput : BaseOutput() { +internal open class BufferedOutput : BaseOutput() { var buffer = "" override fun print(message: Any?) { @@ -58,7 +58,7 @@ private open class BufferedOutput : BaseOutput() { /** JsName used to make the declaration available outside of module to test it */ @JsName("BufferedOutputToConsoleLog") -private class BufferedOutputToConsoleLog : BufferedOutput() { +internal class BufferedOutputToConsoleLog : BufferedOutput() { override fun print(message: Any?) { var s = String(message) val i = s.lastIndexOf('\n') @@ -78,7 +78,7 @@ private class BufferedOutputToConsoleLog : BufferedOutput() { /** JsName used to make the declaration available outside of module to test it and use at try.kotl.in */ @JsName("output") -private var output = run { +internal var output = run { val isNode: Boolean = js("typeof process !== 'undefined' && process.versions && !!process.versions.node") if (isNode) NodeJsOutput(js("process.stdout")) else BufferedOutputToConsoleLog() } diff --git a/libraries/stdlib/js/src/kotlin/exceptionUtils.kt b/libraries/stdlib/js/src/kotlin/exceptionUtils.kt index 284e0ddc893..af31b54e935 100644 --- a/libraries/stdlib/js/src/kotlin/exceptionUtils.kt +++ b/libraries/stdlib/js/src/kotlin/exceptionUtils.kt @@ -6,21 +6,21 @@ // a package is omitted to get declarations directly under the module @JsName("throwNPE") -private fun throwNPE(message: String) { +internal fun throwNPE(message: String) { throw NullPointerException(message) } @JsName("throwCCE") -private fun throwCCE() { +internal fun throwCCE() { throw ClassCastException("Illegal cast") } @JsName("throwISE") -private fun throwISE(message: String) { +internal fun throwISE(message: String) { throw IllegalStateException(message) } @JsName("throwUPAE") -private fun throwUPAE(propertyName: String) { +internal fun throwUPAE(propertyName: String) { throw UninitializedPropertyAccessException("lateinit property ${propertyName} has not been initialized") }