kotlin-jupyter icon indicating copy to clipboard operation
kotlin-jupyter copied to clipboard

Cannot use a library with a dependency on Kotlin compiler

Open koperagen opened this issue 1 year ago • 0 comments

@file:DependsOn("com.lemonappdev:konsist:0.13.0")
import com.lemonappdev.konsist.api.*
import com.lemonappdev.konsist.api.declaration.*

val functions = Konsist.scopeFromProduction()
            .functions()

image

Issue can be narrowed down to this code. Even though both classes are present in the same kotlin-compiler artifact, kernel throws exception

@file:DependsOn("org.jetbrains.kotlin:kotlin-compiler:1.9.10")
org.jetbrains.kotlin.idea.KotlinFileType.INSTANCE as com.intellij.openapi.fileTypes.FileType

Looks like classes are loaded by a different ClassLoaders due to this https://github.com/Kotlin/kotlin-jupyter/blob/ac355e90e9cd5f3ffc147eafc591c4f1fc29070a/src/main/kotlin/org/jetbrains/kotlinx/jupyter/repl.kt#L348C30-L348C30

koperagen avatar Jan 16 '24 15:01 koperagen