[stdlib] Explicit visibility and return types: JVM
This commit is contained in:
committed by
Space Team
parent
c77930c1ea
commit
2e030f213b
@@ -41,7 +41,7 @@ public actual inline fun <T : java.lang.AutoCloseable?, R> T.use(block: (T) -> R
|
||||
|
||||
@SinceKotlin("1.2")
|
||||
@PublishedApi
|
||||
internal fun java.lang.AutoCloseable?.closeFinally(cause: Throwable?) = when {
|
||||
internal fun java.lang.AutoCloseable?.closeFinally(cause: Throwable?): Unit = when {
|
||||
this == null -> {}
|
||||
cause == null -> close()
|
||||
else ->
|
||||
|
||||
@@ -482,7 +482,7 @@ public inline fun Path.deleteExisting() {
|
||||
@WasExperimental(ExperimentalPathApi::class)
|
||||
@Throws(IOException::class)
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun Path.deleteIfExists() =
|
||||
public inline fun Path.deleteIfExists(): Boolean =
|
||||
Files.deleteIfExists(this)
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
package kotlin
|
||||
|
||||
public open class KotlinNullPointerException : NullPointerException {
|
||||
constructor()
|
||||
public constructor()
|
||||
|
||||
constructor(message: String?) : super(message)
|
||||
public constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
package kotlin
|
||||
|
||||
public actual open class NoWhenBranchMatchedException : RuntimeException {
|
||||
actual constructor()
|
||||
public actual constructor()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
package kotlin
|
||||
|
||||
public open class TypeCastException : ClassCastException {
|
||||
constructor()
|
||||
public constructor()
|
||||
|
||||
constructor(message: String?) : super(message)
|
||||
public constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
package kotlin
|
||||
|
||||
public actual class UninitializedPropertyAccessException : RuntimeException {
|
||||
actual constructor()
|
||||
public actual constructor()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ package kotlin.jvm
|
||||
import java.lang.Error
|
||||
|
||||
public open class KotlinReflectionNotSupportedError : Error {
|
||||
constructor() : super("Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath")
|
||||
public constructor() : super("Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath")
|
||||
|
||||
constructor(message: String?) : super(message)
|
||||
public constructor(message: String?) : super(message)
|
||||
|
||||
constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
constructor(cause: Throwable?) : super(cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ private const val MAX_SIZE = Int.MAX_VALUE - 2 // empirically maximal array size
|
||||
@Deprecated("This function will be made internal in a future release")
|
||||
@DeprecatedSinceKotlin(warningSince = "1.9")
|
||||
@JvmName("toArray")
|
||||
fun collectionToArray(collection: Collection<*>): Array<Any?> =
|
||||
public fun collectionToArray(collection: Collection<*>): Array<Any?> =
|
||||
toArrayImpl(
|
||||
collection,
|
||||
empty = { EMPTY },
|
||||
@@ -31,7 +31,7 @@ fun collectionToArray(collection: Collection<*>): Array<Any?> =
|
||||
@Deprecated("This function will be made internal in a future release")
|
||||
@DeprecatedSinceKotlin(warningSince = "1.9")
|
||||
@JvmName("toArray")
|
||||
fun collectionToArray(collection: Collection<*>, a: Array<Any?>?): Array<Any?> {
|
||||
public fun collectionToArray(collection: Collection<*>, a: Array<Any?>?): Array<Any?> {
|
||||
// Collection.toArray contract requires that NullPointerException is thrown when array is null
|
||||
if (a == null) throw JavaNPE()
|
||||
return toArrayImpl(
|
||||
|
||||
@@ -79,7 +79,7 @@ public inline fun Timer.scheduleAtFixedRate(time: Date, period: Long, crossinlin
|
||||
|
||||
// exposed as public
|
||||
@PublishedApi
|
||||
internal fun timer(name: String?, daemon: Boolean) = if (name == null) Timer(daemon) else Timer(name, daemon)
|
||||
internal fun timer(name: String?, daemon: Boolean): Timer = if (name == null) Timer(daemon) else Timer(name, daemon)
|
||||
|
||||
/**
|
||||
* Creates a timer that executes the specified [action] periodically, starting after the specified [initialDelay]
|
||||
|
||||
@@ -74,5 +74,5 @@ private inline fun <reified T : Any> castToBaseType(instance: Any): T {
|
||||
*/
|
||||
@PublishedApi
|
||||
@SinceKotlin("1.2")
|
||||
internal fun apiVersionIsAtLeast(major: Int, minor: Int, patch: Int) =
|
||||
internal fun apiVersionIsAtLeast(major: Int, minor: Int, patch: Int): Boolean =
|
||||
KotlinVersion.CURRENT.isAtLeast(major, minor, patch)
|
||||
|
||||
@@ -51,7 +51,7 @@ public inline fun <T : Closeable?, R> T.use(block: (T) -> R): R {
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@PublishedApi
|
||||
internal fun Closeable?.closeFinally(cause: Throwable?) = when {
|
||||
internal fun Closeable?.closeFinally(cause: Throwable?): Unit = when {
|
||||
this == null -> {}
|
||||
cause == null -> close()
|
||||
else ->
|
||||
|
||||
@@ -167,7 +167,7 @@ public actual fun readlnOrNull(): String? = readLine()
|
||||
*
|
||||
* @return the line read or `null` if the input stream is redirected to a file and the end of file has been reached.
|
||||
*/
|
||||
fun readLine(): String? = LineReader.readLine(System.`in`, Charset.defaultCharset())
|
||||
public fun readLine(): String? = LineReader.readLine(System.`in`, Charset.defaultCharset())
|
||||
|
||||
// Singleton object lazy initializes on the first use, internal for tests
|
||||
internal object LineReader {
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlin.internal.RequireKotlinVersionKind
|
||||
@SinceKotlin("1.2")
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@Deprecated("Switch to new -Xjvm-default modes: `all` or `all-compatibility`", level = DeprecationLevel.ERROR)
|
||||
annotation class JvmDefault
|
||||
public annotation class JvmDefault
|
||||
|
||||
/**
|
||||
* Prevents the compiler from generating compatibility accessors for the annotated class or interface, and suppresses
|
||||
@@ -32,7 +32,7 @@ annotation class JvmDefault
|
||||
@SinceKotlin("1.4")
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class JvmDefaultWithoutCompatibility
|
||||
public annotation class JvmDefaultWithoutCompatibility
|
||||
|
||||
/**
|
||||
* Forces the compiler to generate compatibility accessors for the annotated interface in the `DefaultImpls` class.
|
||||
@@ -45,4 +45,4 @@ annotation class JvmDefaultWithoutCompatibility
|
||||
@RequireKotlin("1.6", versionKind = RequireKotlinVersionKind.COMPILER_VERSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class JvmDefaultWithCompatibility
|
||||
public annotation class JvmDefaultWithCompatibility
|
||||
|
||||
@@ -27,7 +27,7 @@ package kotlin.reflect
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
enum class KVisibility {
|
||||
public enum class KVisibility {
|
||||
/**
|
||||
* Visibility of declarations marked with the `public` modifier, or with no modifier at all.
|
||||
*/
|
||||
|
||||
@@ -161,7 +161,7 @@ public actual enum class CharCategory(public val value: Int, public actual val c
|
||||
*/
|
||||
public actual operator fun contains(char: Char): Boolean = Character.getType(char) == this.value
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
/**
|
||||
* Returns the [CharCategory] corresponding to the specified [category] that represents a Java general category constant.
|
||||
*
|
||||
|
||||
@@ -78,7 +78,7 @@ public actual inline fun StringBuilder.deleteRange(startIndex: Int, endIndex: In
|
||||
@SinceKotlin("1.4")
|
||||
@kotlin.internal.InlineOnly
|
||||
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
|
||||
public actual inline fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length) =
|
||||
public actual inline fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length): Unit =
|
||||
this.getChars(startIndex, endIndex, destination, destinationOffset)
|
||||
|
||||
/**
|
||||
|
||||
@@ -313,7 +313,7 @@ internal constructor(private val nativePattern: Pattern) : Serializable {
|
||||
private fun readResolve(): Any = Regex(Pattern.compile(pattern, flags))
|
||||
}
|
||||
|
||||
actual companion object {
|
||||
public actual companion object {
|
||||
/**
|
||||
* Returns a regular expression that matches the specified [literal] string literally.
|
||||
* No characters of that string will have special meaning when searching for an occurrence of the regular expression.
|
||||
|
||||
Reference in New Issue
Block a user