Last active
September 15, 2019 13:00
-
-
Save martinbonnin/8d57721190a9cd50dadec8456e90cbfe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/JetBrains/kotlin/blob/65244b4bea81f737466618927d4f3afe339cad0d/libraries/stdlib/jvm/src/kotlin/internal/PlatformImplementations.kt#L42 | |
internal val IMPLEMENTATIONS: PlatformImplementations = run { | |
val version = getJavaVersion() | |
if (version >= 0x10008) { | |
try { | |
return@run castToBaseType<PlatformImplementations>(Class.forName("kotlin.internal.jdk8.JDK8PlatformImplementations").newInstance()) | |
} catch (e: ClassNotFoundException) { } | |
try { | |
return@run castToBaseType<PlatformImplementations>(Class.forName("kotlin.internal.JRE8PlatformImplementations").newInstance()) | |
} catch (e: ClassNotFoundException) { } | |
} | |
if (version >= 0x10007) { | |
try { | |
return@run castToBaseType<PlatformImplementations>(Class.forName("kotlin.internal.jdk7.JDK7PlatformImplementations").newInstance()) | |
} catch (e: ClassNotFoundException) { } | |
try { | |
return@run castToBaseType<PlatformImplementations>(Class.forName("kotlin.internal.JRE7PlatformImplementations").newInstance()) | |
} catch (e: ClassNotFoundException) { } | |
} | |
PlatformImplementations() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment