Does anyone know why the Kotlin compiler does not work with JDK 20, even with the Maven extension in...
g
Does anyone know why the Kotlin compiler does not work with JDK 20, even with the Maven extension instead of Gradle? 🤔
s
which version of Kotlin and the Maven extension do you use? maybe at least one of those doesn't support JDK 20 yet? e.g. it looks like before Kotlin 1.7, the kapt had issues with the latest jdks
g
@Stephan Schröder If you use raw
kotlinc
compiler, it will say that it doesn't support JDK 20
Copy code
[user@MSI]$ ./bin/kotlinc -jvm-target 20 example.kt
error: unknown JVM target version: 20
Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
I dunno if JDK 20 as a target bytecode is important, but I was trying to use some of the experimental/preview features from the 20 EA
s
It's my best guess that this is the issue. But it is only a guess. It's actually one of the (smaller but still nice) reasons I prefer Kotlin over Java: you can increase the language version without being automatically increasing the bytecode version. I think it was a Spring project I once wanted to upgrade to an non-LTS Java version, but Spring uses ByteBuddy (if I'm not mistaken) and ByteBody didn't add support for the new bytecode version until 3 months in, which is 50% of the lifetime of a non-LTS Java version 😒
👌 1
1368 Views