All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlinx.jupyter.util.ClassLoading.kt Maven / Gradle / Ivy

There is a newer version: 0.12.0-335
Show newest version
package org.jetbrains.kotlinx.jupyter.util

val kernelFqnPrefixes =
    listOf(
        "kotlin.",
        "org.jetbrains.kotlin.",
        "jupyter.kotlin.",
        "org.jetbrains.kotlinx.jupyter.api.",
        "kotlinx.serialization.",
    )

fun createDefaultDelegatingClassLoader(parent: ClassLoader): ClassLoader {
    val strategy =
        ClassLoadingDelegatingStrategy { classFqn: String, parentLoader: ClassLoader ->
            val shouldLoadFromKernelClassLoader = kernelFqnPrefixes.any { classFqn.startsWith(it) }
            if (shouldLoadFromKernelClassLoader) {
                parentLoader
            } else {
                parentLoader.parent
            }
        }

    return DelegatingClassLoader(parent, strategy)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy