Is there any table which Kotlin version is used by...
# intellij
h
Is there any table which Kotlin version is used by the Kotlin IntelliJ plugin? I want to use kotlin.k2.only.bundled.compiler.plugins.enabled=false but I needed to migrate to the 2.2.0 FIR api (using context parameters in the FIR checkers), but IntelliJ does not use the new api yet, so my checker does not work.
a
Which version of IJ do you use? 2025.2 EAP should have context parameters related fixes.
h
Latest stable release of 2025.1
a
I think, it's expected that it's not supported there. As I said, 2025.2 should be a better choice for context parameters
h
Yeah, I tried 2025.2 and now I got another error:
Copy code
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.diagnostics.DiagnosticFactory2DelegateProvider.<init>(org.jetbrains.kotlin.diagnostics.Severity, org.jetbrains.kotlin.diagnostics.AbstractSourceElementPositioningStrategy, kotlin.reflect.KClass)' [in thread "DefaultDispatcher-worker-23"]
	at app.softwork.serviceloader.plugin.kotlin.fir.ServiceLoaderErrors.<clinit>(ServiceLoaderErrors.kt:23)
	at app.softwork.serviceloader.plugin.kotlin.fir.ServiceLoaderClassChecker.check(ServiceLoaderClassChecker.kt:53)
	at app.softwork.serviceloader.plugin.kotlin.fir.ServiceLoaderClassChecker.check(ServiceLoaderClassChecker.kt:19)
	at org.jetbrains.kotlin.fir.analysis.checkers.declaration.DeclarationCheckersDiagnosticComponent.visitRegularClass(DeclarationCheckersDiagnosticComponent.kt:275)
Caused by this commit https://github.com/JetBrains/kotlin/commit/f8d67d46655e2ebc376e1176c2791ae8aa93b4f5 changing the constructor of DiagnosticFactory2DelegateProvider I guess 2025.2 already uses 2.2.20? I saw this tag: build-2.2.20-ij252-3
I understand the option
kotlin.k2.only.bundled.compiler.plugins.enabled=false
is experimental, but it seeing the FIR errors in IDEA is incredible nice
a
cc @dmitriy.novozhilov could you please help us?
d
cc @bnorm
h
BTW the delegate function is inlined, and adding the context parameter is an abi breaking change anyway.
b
So when dealing with compiler plugins in the IDE, we need to make sure the compiler plugin matches the "Kotlin analyzer version" found in the "About IntelliJ" when internal mode is active. Here's IntelliJ 2025.1.3 for example.
It is true that IntelliJ will often use a version of Kotlin that isn't even released yet as is the case with 2025.2. I believe these Kotlin builds are taken directly from the master branch of the Kotlin repository.
h
Okay, but do you also bundle the core Kotlin compiler plugins in IntelliJ too (with eg 2.2.20)? Otherwise, I don’t understand why the eg serialization does not crash with the same error (abi change of the diagnostics) in 2025.2 🤔
👌 1
b
There's a substitution that takes place for built-in compiler plugins. We detect that a project is using the serialization compiler plugin and enable the version of the compiler plugin that's built into the Kotlin analyzer version, not the version from the project. This substitution is actually available as an IntelliJ extension point:
KotlinBundledFirCompilerPluginProvider
. Here's an example IntelliJ plugin which is doing something similar to what IntelliJ is doing internally: https://github.com/Mr3zee/kotlin-plugins/blob/main/src/main/kotlin/com/github/mr3zee/kotlinPlugins/KotlinPluginsProvider.kt
thank you color 1