From 7edb0b339719db49803f5a81c9501816d75077b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Tue, 23 Sep 2025 11:48:21 +0200 Subject: [PATCH] Upgrade the build to Java 25 See gh-35531 Closes gh-35530 --- .github/actions/build/action.yml | 2 +- .github/actions/prepare-gradle-build/action.yml | 4 ++-- .github/workflows/ci.yml | 2 +- .sdkmanrc | 2 +- .../org/springframework/build/JavaConventions.java | 2 +- framework-api/framework-api.gradle | 2 +- framework-docs/framework-docs.gradle | 11 ++++++++--- gradle/spring-module.gradle | 2 +- .../MultipartWebClientIntegrationTests.java | 8 ++++++++ 9 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 9eaafdc2da3..1e486fe672c 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -19,7 +19,7 @@ inputs: java-version: description: 'Java version to compile and test with' required: false - default: '24' + default: '25' publish: description: 'Whether to publish artifacts ready for deployment to Artifactory' required: false diff --git a/.github/actions/prepare-gradle-build/action.yml b/.github/actions/prepare-gradle-build/action.yml index c91ca7d9c9a..99f5f23cff1 100644 --- a/.github/actions/prepare-gradle-build/action.yml +++ b/.github/actions/prepare-gradle-build/action.yml @@ -19,7 +19,7 @@ inputs: java-version: description: 'Java version to use for the build' required: false - default: '24' + default: '25' runs: using: composite steps: @@ -30,7 +30,7 @@ runs: java-version: | ${{ inputs.java-early-access == 'true' && format('{0}-ea', inputs.java-version) || inputs.java-version }} ${{ inputs.java-toolchain == 'true' && '17' || '' }} - 24 + 25 - name: Set Up Gradle uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bf511a2827..f1fa7b82622 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: toolchain: false - version: 21 toolchain: true - - version: 24 + - version: 25 toolchain: true exclude: - os: diff --git a/.sdkmanrc b/.sdkmanrc index b280a1b6907..2b4236b43e3 100644 --- a/.sdkmanrc +++ b/.sdkmanrc @@ -1,3 +1,3 @@ # Enable auto-env through the sdkman_auto_env config # Add key=value pairs of SDKs to use below -java=24.0.2-librca +java=25-librca diff --git a/buildSrc/src/main/java/org/springframework/build/JavaConventions.java b/buildSrc/src/main/java/org/springframework/build/JavaConventions.java index 52add8eb780..741999760f2 100644 --- a/buildSrc/src/main/java/org/springframework/build/JavaConventions.java +++ b/buildSrc/src/main/java/org/springframework/build/JavaConventions.java @@ -45,7 +45,7 @@ public class JavaConventions { *

NOTE: If you update this value, you should also update the value used in * the {@code javadoc} task in {@code framework-api.gradle}. */ - private static final JavaLanguageVersion DEFAULT_LANGUAGE_VERSION = JavaLanguageVersion.of(24); + private static final JavaLanguageVersion DEFAULT_LANGUAGE_VERSION = JavaLanguageVersion.of(25); /** * The Java version we should use as the baseline for the compiled bytecode diff --git a/framework-api/framework-api.gradle b/framework-api/framework-api.gradle index b1941e086f0..482719644d4 100644 --- a/framework-api/framework-api.gradle +++ b/framework-api/framework-api.gradle @@ -22,7 +22,7 @@ dependencies { javadoc { javadocTool.set(javaToolchains.javadocToolFor({ - languageVersion = JavaLanguageVersion.of(24) + languageVersion = JavaLanguageVersion.of(25) })) title = "${rootProject.description} ${version} API" diff --git a/framework-docs/framework-docs.gradle b/framework-docs/framework-docs.gradle index 0f270035829..1ba931790dc 100644 --- a/framework-docs/framework-docs.gradle +++ b/framework-docs/framework-docs.gradle @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask plugins { @@ -43,10 +44,14 @@ repositories { } } -// To avoid a redeclaration error with Kotlin compiler -tasks.named('compileKotlin', KotlinCompilationTask.class) { +// To avoid a redeclaration error with Kotlin compiler and set the JVM target +tasks.withType(KotlinCompilationTask.class).configureEach { javaSources.from = [] - compilerOptions.freeCompilerArgs = [ "-Xannotation-default-target=param-property" ] // Upcoming default, see https://youtrack.jetbrains.com/issue/KT-73255 + compilerOptions.jvmTarget = JvmTarget.JVM_17 + compilerOptions.freeCompilerArgs.addAll( + "-Xjdk-release=17", // Needed due to https://youtrack.jetbrains.com/issue/KT-49746 + "-Xannotation-default-target=param-property" // Upcoming default, see https://youtrack.jetbrains.com/issue/KT-73255 + ) } dependencies { diff --git a/gradle/spring-module.gradle b/gradle/spring-module.gradle index fbece5148fc..e5da374cabb 100644 --- a/gradle/spring-module.gradle +++ b/gradle/spring-module.gradle @@ -78,7 +78,7 @@ javadoc { // Change modularity mismatch from warn to info. // See https://github.com/spring-projects/spring-framework/issues/27497 addStringOption("-link-modularity-mismatch", "info") - // With the javadoc tool on Java 24, it appears that the 'reference' + // With the javadoc tool on Java 25, it appears that the 'reference' // group is always active and the '-reference' flag is not honored. // Thus, we do NOT fail the build on Javadoc warnings due to // cross-module @see and @link references which are only reachable diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MultipartWebClientIntegrationTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MultipartWebClientIntegrationTests.java index 580f7c58d39..6838b519f8b 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MultipartWebClientIntegrationTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/MultipartWebClientIntegrationTests.java @@ -25,6 +25,7 @@ import java.util.stream.Collectors; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; +import org.junit.jupiter.api.condition.JRE; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; @@ -60,8 +61,10 @@ import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.server.adapter.WebHttpHandlerBuilder; import org.springframework.web.testfixture.http.server.reactive.bootstrap.AbstractHttpHandlerIntegrationTests; import org.springframework.web.testfixture.http.server.reactive.bootstrap.HttpServer; +import org.springframework.web.testfixture.http.server.reactive.bootstrap.JettyHttpServer; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assumptions.assumeThat; class MultipartWebClientIntegrationTests extends AbstractHttpHandlerIntegrationTests { @@ -166,6 +169,11 @@ class MultipartWebClientIntegrationTests extends AbstractHttpHandlerIntegrationT @ParameterizedHttpServerTest void transferTo(HttpServer httpServer) throws Exception { + // TODO https://github.com/spring-projects/spring-framework/issues/35531 + if (JRE.JAVA_25.isCurrentVersion()) { + assumeThat(httpServer).isNotInstanceOf(JettyHttpServer.class); + } + startServer(httpServer); Flux result = webClient