Created
September 14, 2019 15:16
-
-
Save martinbonnin/7a50987dd8356be3eb97f957b67eb204 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
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