Adjust exposed visibility of platform specific implementations.
This commit is contained in:
@@ -20,44 +20,42 @@ internal open class PlatformImplementations {
|
|||||||
public open fun getMatchResultNamedGroup(matchResult: MatchResult, name: String): MatchGroup? {
|
public open fun getMatchResultNamedGroup(matchResult: MatchResult, name: String): MatchGroup? {
|
||||||
throw UnsupportedOperationException("Retrieving groups by name is not supported on this platform.")
|
throw UnsupportedOperationException("Retrieving groups by name is not supported on this platform.")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
companion object {
|
|
||||||
@JvmField
|
@kotlin.internal.InlineExposed
|
||||||
@InlineExposed
|
internal fun platformCloseSuppressed(instance: Closeable, cause: Throwable) = IMPLEMENTATIONS.closeSuppressed(instance, cause)
|
||||||
val INSTANCE: PlatformImplementations = run {
|
|
||||||
val version = getJavaVersion()
|
|
||||||
try {
|
@JvmField
|
||||||
if (version >= 0x10008)
|
internal val IMPLEMENTATIONS: PlatformImplementations = run {
|
||||||
return@run Class.forName("kotlin.internal.JDK8PlatformImplementations").newInstance() as PlatformImplementations
|
val version = getJavaVersion()
|
||||||
} catch (e: ClassNotFoundException) {}
|
try {
|
||||||
|
if (version >= 0x10008)
|
||||||
try {
|
return@run Class.forName("kotlin.internal.JRE8PlatformImplementations").newInstance() as PlatformImplementations
|
||||||
if (version >= 0x10007)
|
} catch (e: ClassNotFoundException) {}
|
||||||
return@run Class.forName("kotlin.internal.JDK7PlatformImplementations").newInstance() as PlatformImplementations
|
|
||||||
} catch (e: ClassNotFoundException) {}
|
try {
|
||||||
|
if (version >= 0x10007)
|
||||||
PlatformImplementations()
|
return@run Class.forName("kotlin.internal.JRE7PlatformImplementations").newInstance() as PlatformImplementations
|
||||||
}
|
} catch (e: ClassNotFoundException) {}
|
||||||
|
|
||||||
private fun getJavaVersion(): Int {
|
PlatformImplementations()
|
||||||
val default = 0x10006
|
}
|
||||||
val version = System.getProperty("java.version") ?: return default
|
|
||||||
val firstDot = version.indexOf('.')
|
private fun getJavaVersion(): Int {
|
||||||
if (firstDot < 0) return default
|
val default = 0x10006
|
||||||
var secondDot = version.indexOf('.', firstDot + 1)
|
val version = System.getProperty("java.version") ?: return default
|
||||||
if (secondDot < 0) secondDot = version.length
|
val firstDot = version.indexOf('.')
|
||||||
|
if (firstDot < 0) return default
|
||||||
val firstPart = version.substring(0, firstDot)
|
var secondDot = version.indexOf('.', firstDot + 1)
|
||||||
val secondPart = version.substring(firstDot + 1, secondDot)
|
if (secondDot < 0) secondDot = version.length
|
||||||
return try {
|
|
||||||
firstPart.toInt() * 0x10000 + secondPart.toInt()
|
val firstPart = version.substring(0, firstDot)
|
||||||
} catch (e: NumberFormatException) {
|
val secondPart = version.substring(firstDot + 1, secondDot)
|
||||||
default
|
return try {
|
||||||
}
|
firstPart.toInt() * 0x10000 + secondPart.toInt()
|
||||||
}
|
} catch (e: NumberFormatException) {
|
||||||
|
default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import java.io.*
|
|||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.util.NoSuchElementException
|
import java.util.NoSuchElementException
|
||||||
import kotlin.internal.PlatformImplementations
|
import kotlin.internal.*
|
||||||
|
|
||||||
|
|
||||||
/** Returns a buffered reader wrapping this Reader, or this Reader itself if it is already buffered. */
|
/** Returns a buffered reader wrapping this Reader, or this Reader itself if it is already buffered. */
|
||||||
@@ -159,7 +159,7 @@ public inline fun <T : Closeable, R> T.use(block: (T) -> R): R {
|
|||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
closed = true
|
closed = true
|
||||||
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||||
PlatformImplementations.INSTANCE.closeSuppressed(this, e)
|
platformCloseSuppressed(this, e)
|
||||||
throw e
|
throw e
|
||||||
} finally {
|
} finally {
|
||||||
if (!closed) {
|
if (!closed) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package kotlin.text
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.regex.Matcher
|
import java.util.regex.Matcher
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
import kotlin.internal.DefaultPlatformImplementations
|
import kotlin.internal.IMPLEMENTATIONS
|
||||||
|
|
||||||
private interface FlagEnum {
|
private interface FlagEnum {
|
||||||
public val value: Int
|
public val value: Int
|
||||||
@@ -247,7 +247,7 @@ private class MatcherMatchResult(private val matcher: Matcher, private val input
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
override fun get(name: String): MatchGroup? {
|
override fun get(name: String): MatchGroup? {
|
||||||
return DefaultPlatformImplementations.INSTANCE.getMatchResultNamedGroup(matchResult, name)
|
return IMPLEMENTATIONS.getMatchResultNamedGroup(matchResult, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1583,6 +1583,10 @@ public final class kotlin/concurrent/TimersKt {
|
|||||||
public static final fun timer (Ljava/lang/String;Z)Ljava/util/Timer;
|
public static final fun timer (Ljava/lang/String;Z)Ljava/util/Timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class kotlin/internal/PlatformImplementationsKt {
|
||||||
|
public static final fun platformCloseSuppressed (Ljava/io/Closeable;Ljava/lang/Throwable;)V
|
||||||
|
}
|
||||||
|
|
||||||
public final class kotlin/io/AccessDeniedException : kotlin/io/FileSystemException {
|
public final class kotlin/io/AccessDeniedException : kotlin/io/FileSystemException {
|
||||||
public fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;)V
|
public fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;)V
|
||||||
public synthetic fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
public synthetic fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
@@ -2082,6 +2086,10 @@ public abstract interface class kotlin/text/MatchGroupCollection : java/util/Col
|
|||||||
public abstract fun get (I)Lkotlin/text/MatchGroup;
|
public abstract fun get (I)Lkotlin/text/MatchGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract interface class kotlin/text/MatchNamedGroupCollection : kotlin/text/MatchGroupCollection {
|
||||||
|
public abstract fun get (Ljava/lang/String;)Lkotlin/text/MatchGroup;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract interface class kotlin/text/MatchResult {
|
public abstract interface class kotlin/text/MatchResult {
|
||||||
public abstract fun getDestructured ()Lkotlin/text/MatchResult$Destructured;
|
public abstract fun getDestructured ()Lkotlin/text/MatchResult$Destructured;
|
||||||
public abstract fun getGroupValues ()Ljava/util/List;
|
public abstract fun getGroupValues ()Ljava/util/List;
|
||||||
|
|||||||
Reference in New Issue
Block a user