From 528f7ebfc3c2ffe2fe5007b29054be406102bd7b Mon Sep 17 00:00:00 2001 From: Turan Asikoglu <874158+trexx@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:04:00 +0200 Subject: [PATCH] Move the Java toolchain and source level to JDK 26 Bump the toolchain, sourceCompatibility/targetCompatibility and both CI setup-java steps from 25 to 26, and correct the docs and comments that name the version. The JaCoCo pin stays at 0.8.15: its comment claimed it was the first release for Java 25 class files (that was 0.8.14); it is in fact the first with official support for the major version 70 files JDK 26 emits, so the comment now says that. 26 is as far as the current stack goes. Verified against AGP 9.4.0, Gradle 9.6.1: javac, R8 (debug and optimising release), all 314 unit tests, JaCoCo and lintRelease pass on JDK 26 output, with the Gradle daemon on both 25 and 26. JDK 27 (GA 2026-09-15) also compiles, dexes and tests, but Android Lint logs "Unsupported class file major version 71" for every class and still exits green with its bytecode checks skipped - a silent loss of the CI gate, so the toolchain comment records that trap for the next bump. Latency and performance impact: none. Only the build toolchain changes; R8 desugars the same source to the same API 30 target, and no runtime code is touched. Co-Authored-By: Claude Opus 5 --- .github/workflows/build.yml | 4 ++-- CLAUDE.md | 4 ++-- README.md | 2 +- app/build.gradle | 16 ++++++++++------ gradle.properties | 2 +- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26245e185..0d4af2a0f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: - name: Setup Java JDK uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6 with: - java-version: 25 + java-version: 26 distribution: 'corretto' - name: Setup Android SDK @@ -82,7 +82,7 @@ jobs: - name: Setup Java JDK uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6 with: - java-version: 25 + java-version: 26 distribution: 'corretto' - name: Setup Android SDK diff --git a/CLAUDE.md b/CLAUDE.md index 521cd9427..add595109 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -40,7 +40,7 @@ because the alternative has cost something here. ./gradlew assembleRelease lintRelease # what CI gates on; runs ndk-build for both ABIs, slow ``` -Toolchain: AGP 9.3.1, Gradle 9.6.1, Java 25 toolchain, NDK pinned in `app/build.gradle`. The JDK +Toolchain: AGP 9.4.0, Gradle 9.6.1, Java 26 toolchain, NDK pinned in `app/build.gradle`. The JDK and NDK are downloaded automatically. `git submodule update --init --recursive` is required before any native build. @@ -245,7 +245,7 @@ how regressions get reintroduced. ## Modernisation -Source and target level are **Java 25**. Of the modern constructs, three are in use: `var` +Source and target level are **Java 26**. Of the modern constructs, three are in use: `var` (`UsbDriverService`, `XboxWirelessDongle`), records (`GameMenu.MenuOption`, `ComputerDetails.AddressTuple`) and switch expressions (`BrowseState`). Pattern-matching `instanceof` and text blocks appear nowhere yet. Nothing is known to be broken; they simply have diff --git a/README.md b/README.md index 54727dfff..a5cd2afae 100644 --- a/README.md +++ b/README.md @@ -413,7 +413,7 @@ or take the signed APK artifact from a [Build workflow](.github/workflows/build. * Run ‘git submodule update --init --recursive’ from within moonlight-android/ * Build the APK using Android Studio or ‘./gradlew assembleRelease’ -The NDK (pinned by ‘ndkVersion’ in app/build.gradle) and the JDK 25 toolchain used to +The NDK (pinned by ‘ndkVersion’ in app/build.gradle) and the JDK 26 toolchain used to compile Java are both downloaded automatically. Python 3 is needed at build time for the patch step below, which runs from `preBuild`. diff --git a/app/build.gradle b/app/build.gradle index adc4af2cc..5093d71cf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -70,8 +70,8 @@ android { compileOptions { // Explicit so the build does not depend on the platform default encoding encoding = "UTF-8" - sourceCompatibility = JavaVersion.VERSION_25 - targetCompatibility = JavaVersion.VERSION_25 + sourceCompatibility = JavaVersion.VERSION_26 + targetCompatibility = JavaVersion.VERSION_26 } lint { @@ -181,10 +181,13 @@ android { } } -// Compile with JDK 25 regardless of the JDK running Gradle. +// Compile with JDK 26 regardless of the JDK running Gradle. 26 is the newest JDK whose class files +// (major version 70) Android Lint can read: JDK 27 output makes lint log "Unsupported class file +// major version 71" for every class and still exit green with its bytecode checks skipped, so a +// bump past 26 needs that re-checked, not just a green CI run. java { toolchain { - languageVersion = JavaLanguageVersion.of(25) + languageVersion = JavaLanguageVersion.of(26) } } @@ -197,8 +200,9 @@ tasks.withType(Test).configureEach { .withPathSensitivity(PathSensitivity.RELATIVE) } -// 0.8.15 is the first release that understands class file major version 69, which is what the -// JDK 25 toolchain above emits. Older versions fail instrumentation outright. +// 0.8.15 is the first release with official support for class file major version 70, which is +// what the JDK 26 toolchain above emits; 0.8.14 only read it experimentally, and older versions +// fail instrumentation outright. jacoco { toolVersion = '0.8.15' } diff --git a/gradle.properties b/gradle.properties index aacebcbe0..e0e68a2b5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ org.gradle.parallel=true org.gradle.caching=true # This project is Java-only. AGP's built-in Kotlin compiler caps jvmTarget at 24, -# which would block the JDK 25 toolchain used for Java compilation. +# which would block the JDK 26 toolchain used for Java compilation. # NOTE: AGP reports this option as deprecated. If it is removed, the Java # bytecode target must drop to whatever the bundled Kotlin compiler supports. android.builtInKotlin=false