KT-44089 Try to use all known PlatformImplementation classes in Android

Currently platform method implementations loaded are limited by the
java.specification.version system property value, however that property
always returns 0.9 in Android.
This commit is contained in:
Ilya Gorbunov
2021-11-18 12:10:20 +03:00
committed by TeamCityServer
parent 219d9707ec
commit fe77046fe4
@@ -49,7 +49,7 @@ internal open class PlatformImplementations {
@JvmField
internal val IMPLEMENTATIONS: PlatformImplementations = run {
val version = getJavaVersion()
if (version >= 0x10008) {
if (version >= 0x10008 || version < 0x10000) {
try {
return@run castToBaseType<PlatformImplementations>(Class.forName("kotlin.internal.jdk8.JDK8PlatformImplementations").newInstance())
} catch (e: ClassNotFoundException) { }
@@ -58,7 +58,7 @@ internal val IMPLEMENTATIONS: PlatformImplementations = run {
} catch (e: ClassNotFoundException) { }
}
if (version >= 0x10007) {
if (version >= 0x10007 || version < 0x10000) {
try {
return@run castToBaseType<PlatformImplementations>(Class.forName("kotlin.internal.jdk7.JDK7PlatformImplementations").newInstance())
} catch (e: ClassNotFoundException) { }