NoSuchMethodError for KtPsiFactory?
Hello! I'm working on my plugin for ktlint support.
I'm adding an action to create a comment to disable an error, but when I try to construct a KtPsiFactory instance, I get the following error:
java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.psi.KtPsiFactory.<init>(com.intellij.openapi.project.Project, boolean, int, kotlin.jvm.internal.DefaultConstructorMarker)'
I see that KtPsiFactory is defined in the unzipped Kotlin plugin source, but I can't think of why it wouldn't be accessible at runtime. My build.gradle.kts is based on the plugin template, and the full file can be viewed here: https://github.com/nbadal/ktlint-intellij-plugin/blob/main/build.gradle.kts
I've tried adding the following dependencies, and none helped resolve the class:
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("compiler-embeddable"))
implementation(kotlin("gradle-plugin"))
implementation(kotlin("reflect"))
Please sign in to leave a comment.
Nick, sorry for the late reply – this post was somehow buried among the others. Did you manage to solve it?