Compatibilty of Java25 and build.gradle.kts
With the combination of Java21 + Gradle 9.1.0 + latest Openrewrite Gradle Plugin 7.18.0 the build.gradle.kts within the attached reproducer gets rewritten correctly
- spring boot will be updated to 4.0.0-M3
- dependencies for starter-telemetry and starter-restlclient will be added
However when swapping out the runtime from Java21 to Java25, the build.gradle.kts is untouched after rewrite.
Java Classes on the other hand(removed from this minimal reproducer) seem to get updated.
So is Openrewrite compatible with Java25 already ?
hi! Thanks for the report; wasn't aware of any specific issues, but the combination of 9.1.0 + Java 25 is quite new, also to us. Like you we haven't seen issues changing Java sources. Do you see any parsing issues in the output? Any output when running Find ParseExceptionResult markers?
Thx 4 the very fast reply. Yes there are. numerous cannot parse file errors, but I even have similar ones with working projects. I suggest to tryout the simple reproducer i attached and take a look for yourself ... I think this will be easier to debug then.
As for the combination, the same happens with gradle 9.0 + java25. And Gradle 8 + java25 is not working at all. But Gradle 9.1.0 + java21 does ....
The bytecode does not seem to be the reason, becacause when downgrading source level to 21 with java25, it still bugs out
I'll see if I can fit in running that reproducer when I get home Friday; any details you can already share here would be helpful.
Sure, thx 4 investing your private time .. wasnt aware of that I've attached the debug output for 3 different runs (debug.zip I've now spotted the possible problem see below. However its odd how it gets there and what the connection to INtellij is. So while this happens running in the console of Intellij, it also happens when running it outside INtellij with the Gradle Wrapper
The error does neither occur when running a simple build, nur with java 21. So there seems to be some kind of connection between openRewrite -> gradle -> intellij libs ?
2025-10-16T07:30:34.229+0200 [WARN] [org.openrewrite.gradle.isolated.DefaultProjectParser] There were problems parsing some source files, run with --info to see full stack traces 2025-10-16T07:30:34.229+0200 [WARN] [org.openrewrite.gradle.isolated.DefaultProjectParser] There were problems parsing build.gradle.kts 2025-10-16T07:30:34.229+0200 [DEBUG] [org.openrewrite.gradle.isolated.DefaultProjectParser] java.lang.IllegalArgumentException: 25 org.jetbrains.kotlin.com.intellij.util.lang.JavaVersion.parse(JavaVersion.java:305) org.jetbrains.kotlin.com.intellij.util.lang.JavaVersion.current(JavaVersion.java:174) org.jetbrains.kotlin.cli.jvm.modules.JavaVersionUtilsKt.isAtLeastJava9(javaVersionUtils.kt:11) org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem$Companion$globalJrtFsCache$1.invoke(CoreJrtFileSystem.kt:83) org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem$Companion$globalJrtFsCache$1.invoke(CoreJrtFileSystem.kt:74) org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem.globalJrtFsCache$lambda$1(CoreJrtFileSystem.kt:74) org.jetbrains.kotlin.com.intellij.util.containers.ConcurrentFactoryMap$2.create(ConcurrentFactoryMap.java:174)
Could it be related to this issue, because openrewrite has a dependency to kotlin ? That needs to be updated ?
- https://github.com/detekt/detekt/issues/8714
Maybe with an implicit connectin to
- https://github.com/openrewrite/rewrite/issues/6007
Thanks for the added details! Indeed think that the problem here is that our parser for Kotlin, used by our Gradle parser, uses 1.9.x still, whereas that's not supported on Java 25. 😞 There's some ongoing work in https://github.com/openrewrite/rewrite/pull/5963, but it's good to know that Gradle KTS files are not supported when running on Java 25 in the interim.
I suggest you follow that Kotlin v2 PR if you hadn't already for progress there.
- https://github.com/openrewrite/rewrite/pull/5963
One alternative might be to launch Gradle (and with that OpenRewrite) from Java 21, and then use toolchains to compile your Java 25 sources with Java 25. That's helped for us to support Gradle 8.14 + Java 25, where 8.14 similarly does not support Java 25 as runtime yet.
thank you for the verification, yes thats acutally what i am currently doing, executing with a java 21 jvm