Use platform class loader in 'kotlin' runner on JDK 9+

#KT-46312 Fixed
This commit is contained in:
Alexander Udalov
2022-08-04 02:02:42 +02:00
parent 2cb6483e8a
commit 45abea5b0a
4 changed files with 50 additions and 15 deletions
@@ -51,7 +51,7 @@ class JvmCliScriptEvaluationExtension : AbstractScriptEvaluationExtension() {
private fun getPlatformClassLoader(): ClassLoader? =
try {
ClassLoader::class.java.getDeclaredMethod("getPlatformClassLoader")?.invoke(null)?.let { it as? ClassLoader }
ClassLoader::class.java.getDeclaredMethod("getPlatformClassLoader")?.invoke(null) as? ClassLoader?
} catch (_: Exception) {
null
}