I was trying to use 2.0.20 here and we started hav...
# compiler
n
I was trying to use 2.0.20 here and we started having
NoClassDefFoundError: kotlinx/coroutines/CoroutineScope
, which could be solved by adding the coroutines jar to our local kotlin home libraries, but I started wondering whether this was indeed something intentional from the Kotlin compiler side or not. At first I thought it was added by mistake, but I see the dependency also shows up in the manifest, so now I'm not sure. Here's the stack trace leading to it:
Copy code
java.lang.NoClassDefFoundError: kotlinx/coroutines/CoroutineScope
    at com.intellij.core.CoreApplicationEnvironment.createApplication(CoreApplicationEnvironment.java:127)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreApplicationEnvironment.createApplication(KotlinCoreApplicationEnvironment.kt:55)
    at com.intellij.core.CoreApplicationEnvironment.<init>(CoreApplicationEnvironment.java:81)
    at com.intellij.core.JavaCoreApplicationEnvironment.<init>(JavaCoreApplicationEnvironment.java:48)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreApplicationEnvironment.<init>(KotlinCoreApplicationEnvironment.kt:43)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreApplicationEnvironment.<init>(KotlinCoreApplicationEnvironment.kt)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreApplicationEnvironment$Companion.create(KotlinCoreApplicationEnvironment.kt:108)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createApplicationEnvironment(KotlinCoreEnvironment.kt:673)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.getOrCreateApplicationEnvironment(KotlinCoreEnvironment.kt:558)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.getOrCreateApplicationEnvironmentForProduction(KotlinCoreEnvironment.kt:534)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:466)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:204)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:155)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:43)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:103)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:49)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
    at org.jetbrains.kotlin.buildtools.internal.CompilationServiceImpl.compileInProcess(CompilationServiceImpl.kt:184)
    at org.jetbrains.kotlin.buildtools.internal.CompilationServiceImpl.compileJvm(CompilationServiceImpl.kt:92)
    at org.jetbrains.kotlin.buildtools.internal.CompilationServiceProxy.compileJvm(CompilationServiceImpl.kt)
    ...
I write here to validate my curiosity on whether this was an intentional addition to the Kotlin compiler or not
d
cc @Alexander.Likhachev
n
@Peng Jiang found this that might be related https://issuetracker.google.com/issues/348324744?pli=1
p
it is also included in the Kotlin 2.1, @Alexander.Likhachev I have done a quick search for the coroutines within the kotlin compiler path in github, looks like they are used only in the compiler/testData? or it is also used in other places? if it is only used in the testData, should we only include it in the test deps?
d
I've checked, and it appeared that coroutines are needed because of dependency on intellij core in 223 version of intellij they started to use coroutines in some core services, which are also used by the compiler (
com.intellij.util.messages.MessageBus
)
👍 2
n
@dmitriy.novozhilov, got it! This means it intentional and here to stay, right? Let me know in case I read that wrong
d
Yep, it will be here until (if) we remove dependency on intellij core from the compiler
👍 1
n
Thank you so much for the clarification, we really appreciate that
👌 1