Skip to content

Getting warning about Kotlin being incompatible with JDK 25 with Gradle 9.1.0, JDK 25, and Kotlin DSL #35204

Description

@tbroyer

Current Behavior

Getting warnings:

> Task :build-logic:compileKotlin
Kotlin does not yet support 25 JDK target, falling back to Kotlin JVM_24 JVM target
w: ⚠️ Inconsistent JVM Target Compatibility Between Java and Kotlin Tasks
Inconsistent JVM-target compatibility detected for tasks 'compileJava' (25) and 'compileKotlin' (24).
This will become an error in Gradle 8.0.
Solution:
Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation

> Configure project :
Kotlin does not yet support 25 JDK target, falling back to Kotlin JVM_24 JVM target

Expected Behavior

No warning at all, as Gradle 9.1.0 is supposedly compatible with JDK 25.

Context (optional)

No response

Self-contained Reproducer Project

Using JDK 25 and Gradle 9.1.0.

  1. Create a project using gradle init

    $ gradle init
    
    Select type of build to generate:
      1: Application
      2: Library
      3: Gradle plugin
      4: Basic (build structure only)
    Enter selection (default: Application) [1..4] 1
    
    Select implementation language:
      1: Java
      2: Kotlin
      3: Groovy
      4: Scala
      5: C++
      6: Swift
    Enter selection (default: Java) [1..6] 1
    
    Enter target Java version (min: 7, default: 21): 25
    
    Project name (default: test): 
    
    Select application structure:
      1: Single application project
      2: Application and library project
    Enter selection (default: Single application project) [1..2] 2
    
    Select build script DSL:
      1: Kotlin
      2: Groovy
    Enter selection (default: Kotlin) [1..2] 1
    
    Generate build using new APIs and behavior (some features may change in the next minor release)? (default: no) [yes, no] yes
    
    
    > Task :init
    Learn more about Gradle by exploring our Samples at https://docs.gradle.org/9.1.0/samples/sample_building_java_applications_multi_project.html
    
    BUILD SUCCESSFUL in 28s
    1 actionable task: 1 executed
    
  2. run gradle tasks (or ./gradle tasks)

    $ gradle tasks
    Calculating task graph as no cached configuration is available for tasks: tasks
    
    > Configure project :app
    Kotlin does not yet support 25 JDK target, falling back to Kotlin JVM_24 JVM target
    
    > Task :build-logic:compileKotlin
    Kotlin does not yet support 25 JDK target, falling back to Kotlin JVM_24 JVM target
    w: ⚠️ Inconsistent JVM Target Compatibility Between Java and Kotlin Tasks
    Inconsistent JVM-target compatibility detected for tasks 'compileJava' (25) and 'compileKotlin' (24).
    This will become an error in Gradle 8.0.
    Solution:
    Consider using JVM Toolchain: https://kotl.in/gradle/jvm/toolchain
    Learn more about JVM-target validation: https://kotl.in/gradle/jvm/target-validation
    
    
    > Task :tasks
    […]
    

Gradle version

9.1.0

Build scan URL (optional)

https://scans.gradle.com/s/ml4t6riodsmh6

Your Environment (optional)

$ gradle --version

------------------------------------------------------------
Gradle 9.1.0
------------------------------------------------------------

Build time:    2025-09-18 21:55:32 UTC
Revision:      <unknown>

Kotlin:        2.2.0
Groovy:        4.0.28
Ant:           Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM:  25.0.1 (Arch Linux 25.0.1)
Daemon JVM:    /usr/lib/jvm/java-25-openjdk (no JDK specified, using current Java home)
OS:            Linux 6.16.8-arch3-1 amd64

$ java --version
openjdk 25.0.1 2025-09-16
OpenJDK Runtime Environment (build 25.0.1)
OpenJDK 64-Bit Server VM (build 25.0.1, mixed mode, sharing)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions