Hacker News new | ask | show | jobs
by chadrs 1714 days ago
Yeah I agree we should be using 17 except Gradle still does not support it, despite having been out for an entire month...

https://docs.gradle.org/current/userguide/compatibility.html

4 comments

Technically it's the Groovy runtime that doesn't support 17 (or specifically, JVM bytecode v62+) yet. And then only because it seems to do an explicit whitelisted-version check during some buildscript static-analysis bootstrap phase.

If you switch your Gradle buildscript files over to being written in Kotlin, the problem goes away, as Kotlin's runtime doesn't seem to use any similar explicit checks.

(Doing so also allows you to go further and test out EA JVM builds, e.g. Project Loom, which Groovy-based buildscripts have never been, and will never be, happy with.)

It should also work with the latest versions of Gradle (7.2 or so), as the Groovy runtime used by Gradle has since been upgraded.

https://github.com/gradle/gradle/issues/16857

Yes, it does now; but the Groovy runtime still has the general problem of not working with each new JVM version for months after it comes out. Whereas, with the Kotlin runtime, you can just forget about this problem and upgrade as soon as you like.
even if the gradle script is written in kotlin, wouldn't you face the issue with gradle regardless?
No, because Gradle isn't checking the JVM version, the Groovy runtime is. (Specifically, the Groovy compiler seems to run fine on the buildscript, producing a buildscript bytecode file; but then, upon load, the Groovy runtime seems to check that buildscript bytecode file's JVM bytecode version metadata before doing whatever-it-does when loading it.)

Gradle itself isn't written in Groovy; it's 5% Java, 95% Kotlin. The Groovy runtime is only spun up to compile and run Groovy buildscripts (i.e. the default kind of Gradle buildscript with a ".gradle" file extension.) If none of your buildscripts are written in Groovy, then you're not compiling or running any Groovy code, so that runtime check never executes.

> Gradle itself isn't written in Groovy; it's 5% Java, 95% Kotlin

This doesn't appear to be true just by looking at the Gradle GitHub repository. It claims that the code in the repo is 46% Groovy, 44% Java and 6% Kotlin

Isn't that kind of thing you'd expect using Gradle? It's not the first time it happened, they have been late to the party for a lot of the recent releases.
I guess it serves right to folks who endlessly hated Maven and liked this "new", "next generation" , "modern" build system with no XML. Turns out as long as JDK-8 is supported version of Java a lot of tools like this look modern.
Gradle does fix plenty of shortcomings of Maven, eg. proper parallel builds, proper task graph (you never have to do clean install on gradle, while it is almost always needed with maven), as well as it is much more performant.
If I understand that page correctly, you can use Java 17 to compile and run your program, as long as you also have Java 16 or older installed to run Gradle itself.
Which is funny because EA builds were out there much longer, just RC was out there for another month.