Skip to content

Upgrade Gradle to 9.3.1 so the build runs on JDK 25 - #123

Merged
amorde merged 2 commits into
mainfrom
fix-codeql-java-kotlin
Nov 11, 2026
Merged

amorde merged 2 commits into
mainfrom
fix-codeql-java-kotlin

Conversation

@amorde

@amorde amorde commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Why

The Analyze (java-kotlin) CodeQL check has failed on main and on every PR since 2026-11-01. The cause is the runner image, not a code change:

  • The ubuntu-latest runner moved from Ubuntu 24.04 (default JDK 17) to Ubuntu 26.04 (default JDK 25).
  • CodeQL's default setup builds Java/Kotlin with autobuild on the runner's default JDK, and Gradle 8.14.3 can't run on JDK 25.
  • The same commit (6b707c0) passed on 2026-10-25 and failed on 2026-11-01. The CodeQL CLI and action versions were the same in both runs.

From the failing autobuild log:

Identified 25.0.5 as the newest version of Java supported by the version of Gradle in use. The system default of 25.0.5 is compatible with this.
[autobuild] Welcome to Gradle 8.14.3!
[autobuild] java.lang.IllegalArgumentException: 25.0.5
	at org.jetbrains.kotlin.com.intellij.util.lang.JavaVersion.parse(JavaVersion.java:307)
	...
	at org.gradle.kotlin.dsl.support.KotlinCompilerKt.compileKotlinScriptModuleTo(KotlinCompiler.kt:231)

Changes

  • Gradle wrapper 8.14.3 → 9.3.1. Gradle can run on JDK 25 starting with 9.1. 9.3.x is the newest line that still bundles Kotlin 2.2.x; 9.4+ bundles Kotlin 2.3+, which the project's Kotlin 2.1 compiler can't read when compiling against gradleApi(). Moving past 9.3 needs a Kotlin upgrade first.

  • JVM target pinned to 11 for all modules (Kotlin jvmTarget plus -Xjdk-release=11, Java source/target compatibility). Without a pin, the target follows the JDK running Gradle:

    • on JDK 25 the build fails, because Kotlin 2.1 can't target 25;
    • and since Gradle 9 needs JDK 17+, published artifacts would otherwise quietly become Java 17.

    Published bytecode (class version 55) and the plugin's org.gradle.jvm.version attribute stay at 11, the same as 0.0.16.

  • Property<String?> → Property<String> in InvertExtension and InvertTask. Gradle 9's nullability annotations reject nullable type arguments, and orNull still returns String?.

  • CI runs on JDK 25. In main.yml, test-ubuntu, publish-snapshot and publish-release move from JDK 11 to 25 (Gradle 9 needs JDK 17+), and the PR test-ubuntu check moves from 17 to 25 to match. github-pages stays on 21 because it runs invert against outside projects with their own Gradle versions.

  • Dokka 2.0.0 → 2.1.0. Dokka 2.0.0 fails on JDK 25 (IllegalArgumentException: 25.0.4 from its bundled IntelliJ version parsing), which would break javadoc jar generation in the publish jobs. 2.1.0 works on both JDK 17 and 25.

Testing

Run locally on JDK 25: assemble check (72 tests, all passing), publishToMavenLocal into a temp repo (all 8 javadoc jars generated), and :invert on the examples project. publishToMavenLocal also passes on JDK 17.

Run locally before the JDK 25 bump:

  • With JDK 25 as JAVA_HOME: the same clean, then testClasses steps CodeQL autobuild runs. This failed before the change and passes after.
  • On JDK 17: ./gradlew assemble check
  • On JDK 17: publishToMavenLocal into a temp repo, including the javadoc jars
  • On JDK 17: :invert on the examples project

Checked bytecode: all JVM jars are class version 55 (Java 11).

Not run locally: the CI publish jobs (they need signing secrets) and the github-pages job, which runs invert against outside projects. The CodeQL check on this PR confirms the fix.

🤖 Generated with Claude Code

The ubuntu-latest runner image moved to Ubuntu 26.04, whose default JDK
is 25. CodeQL's default setup autobuilds with that JDK, and Gradle 8.14.3
cannot run on JDK 25 (IllegalArgumentException: 25.0.5), so
"Analyze (java-kotlin)" has failed since 2026-11-01.

- Upgrade the Gradle wrapper to 9.3.1. Gradle 9.1+ supports running on
  JDK 25; 9.3.x is the newest line whose embedded Kotlin (2.2.21) the
  project's Kotlin 2.1 compiler can still read.
- Pin the JVM target to 11 for all modules (Kotlin jvmTarget,
  -Xjdk-release, Java source/target compatibility). Without it the
  target follows the JDK running Gradle, which breaks on JDK 25 and
  would raise published artifacts above Java 11 now that Gradle needs
  JDK 17+. Published bytecode and the org.gradle.jvm.version attribute
  stay at 11, as in 0.0.16.
- Use Property<String> instead of Property<String?>; Gradle 9's
  nullability annotations reject nullable type arguments.
- Run the main-branch test and publish jobs on JDK 17, since Gradle 9
  requires JDK 17+ to run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amorde
amorde marked this pull request as ready for review November 10, 2026 18:55
Comment thread .github/workflows/main.yml Resolved

@handstandsam handstandsam left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Consider the comment made about Java version 17

Gradle 9.3.1 supports running on JDK 25, so the test and publish jobs
can use it instead of 17. PR checks move to 25 too, so they test the
same JDK as main. github-pages stays on 21 because it runs invert
against external projects with their own Gradle versions.

Dokka 2.0.0 fails on JDK 25 (IllegalArgumentException: 25.0.4 from its
bundled IntelliJ version parsing), which would break javadoc jar
generation in the publish jobs. Dokka 2.1.0 works on both JDK 17 and 25.

Published artifacts still target Java 11 (class version 55,
org.gradle.jvm.version 11).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amorde
amorde merged commit 0ba1420 into main Nov 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants