I have just enabled K2 mode in IntelliJ. My spring...
# spring
r
I have just enabled K2 mode in IntelliJ. My spring boot project uses
kotlin-spring
plugin but now I'm seeing
Classes annotated with '@Configuration' could be implicitly subclassed and must not be final
errors for all my configuration classes. Is this a known issue?
j
see that with
@Transactional
as well
r
I don't have this issue, it seems to be working fine for me. Which versions are you using? I am using:
Copy code
IntelliJ 2024.3
Kotlin 2.0.21
Spring Boot 3.3.5
r
I'm using the same versions (on Linux). Are you sure you have enabled K2 mode? Maybe you are using
open
classes?
r
yes, K2 mode is enabled, and I am not using the
open
keyword
r
Strange :)
Do you use gradle or maven? And is your project Kotlin multiplatform or just Kotlin JVM?
r
Gradle, Kotlin JVM project
I am on Windows though, that's one difference 😅
r
It works fine for me with a different project which is Kotlin JVM.
So it's something with Kotlin multiplatform plugin.
💡 1
@JasonB can you confirm you are using multiplatform plugin as well?
But what's even more strange, I don't have this problem in another multiplatform project (!).
The difference is the other project (without issue) uses spring boot plugin and kotlin mpp plugin together in one module, which is now a deprecated configuration. The problematic project uses a separate JVM module which applies the spring boot plugin (which is recommended solution now). But I have no idea how can this make a difference for IntelliJ?
But apparently it does make a difference. The problem is gone when I apply spring boot plugin to my main module.
Now I've removed the plugin and it still doesn't show errors 🙃
I think I can live with this workaround for now ... 😉
j
I'm on OSX with a pure JVM project, once I turned off K2 and reimported Gradle, everything was fine
j
Hi. Has the solution to this issue been found? I have the exact same problem - as soon as I enabled K2 mode - boom headshot, everything's underscored in red EDIT: Ok, while the gradle reloading didn't help, apparently the right workaround is to "close intellij and open again" 🙂