Add JDK 25 (#319)

Closes #319

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/319 from fmeum:jdk-25 ddc4341c58485a94f3d9882e7afb56f0b9f16a74
PiperOrigin-RevId: 810016900
Change-Id: Icecc0ee3056f1ac357ad92b46c5509403c42adb1
diff --git a/MODULE.bazel b/MODULE.bazel
index 942c1bb..ea1496b 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -99,6 +99,14 @@
         "win",
         "win_arm64",
     ],
+    "25": [
+        "linux",
+        "linux_aarch64",
+        "macos",
+        "macos_aarch64",
+        "win",
+        "win_arm64",
+    ],
 }
 
 REMOTE_JDK_REPOS = [(("remote_jdk" if version == "8" else "remotejdk") + version + "_" + platform) for version in JDKS for platform in JDKS[version]]
diff --git a/java/bazel/repositories_util.bzl b/java/bazel/repositories_util.bzl
index 38170c1..5b05fb2 100644
--- a/java/bazel/repositories_util.bzl
+++ b/java/bazel/repositories_util.bzl
@@ -86,6 +86,16 @@
             },
         },
     },
+    "25": {
+        "zulu": {
+            "release": "25.28.85-ca-jdk25.0.0",
+            "platforms": {
+                "linux": ["aarch64", "x86_64"],
+                "macos": ["aarch64", "x86_64"],
+                "windows": ["arm64", "x86_64"],
+            },
+        },
+    },
 }
 
 _STRIP_PREFIX_OVERRIDES = {
diff --git a/java/extensions.bzl b/java/extensions.bzl
index ad7978b..a791d17 100644
--- a/java/extensions.bzl
+++ b/java/extensions.bzl
@@ -21,6 +21,7 @@
     "remote_jdk11_repos",
     "remote_jdk17_repos",
     "remote_jdk21_repos",
+    "remote_jdk25_repos",
     "remote_jdk8_repos",
 )
 load("//toolchains:extensions.bzl", _java_repository = "java_repository")
@@ -32,6 +33,7 @@
     remote_jdk11_repos()
     remote_jdk17_repos()
     remote_jdk21_repos()
+    remote_jdk25_repos()
 
     if bazel_features.external_deps.extension_metadata_has_reproducible:
         return module_ctx.extension_metadata(reproducible = True)
diff --git a/java/repositories.bzl b/java/repositories.bzl
index 2af2214..09da2ce 100644
--- a/java/repositories.bzl
+++ b/java/repositories.bzl
@@ -325,6 +325,54 @@
         urls = ["https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6+7/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.6_7.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6+7/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.6_7.tar.gz"],
         version = "21",
     ),
+    struct(
+        name = "remotejdk25_linux_aarch64",
+        target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:aarch64"],
+        sha256 = "b60eb9d54c97ba4159547834a98cc5d016281dd2b3e60e7475cba4911324bcb4",
+        strip_prefix = "zulu25.28.85-ca-jdk25.0.0-linux_aarch64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-linux_aarch64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-linux_aarch64.tar.gz"],
+        version = "25",
+    ),
+    struct(
+        name = "remotejdk25_linux",
+        target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:x86_64"],
+        sha256 = "164d901e5a240b8c18516f5ab55bc11fc9689ab6e829045aea8467356dcdb340",
+        strip_prefix = "zulu25.28.85-ca-jdk25.0.0-linux_x64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-linux_x64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-linux_x64.tar.gz"],
+        version = "25",
+    ),
+    struct(
+        name = "remotejdk25_macos_aarch64",
+        target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:aarch64"],
+        sha256 = "73f64f6bad7c3df31fba740fbcbbbef7c1a5cedeffbb5df386dd79bc72aba9b6",
+        strip_prefix = "zulu25.28.85-ca-jdk25.0.0-macosx_aarch64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-macosx_aarch64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-macosx_aarch64.tar.gz"],
+        version = "25",
+    ),
+    struct(
+        name = "remotejdk25_macos",
+        target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:x86_64"],
+        sha256 = "c2cde1d313d904b793c3760214eefa207ecca7df04e7c4084abdf1f6bbebc27a",
+        strip_prefix = "zulu25.28.85-ca-jdk25.0.0-macosx_x64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-macosx_x64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-macosx_x64.tar.gz"],
+        version = "25",
+    ),
+    struct(
+        name = "remotejdk25_win_arm64",
+        target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:arm64"],
+        sha256 = "f5f6d8a913695649e8e2607fe0dc79c81953b2583013ac1fb977c63cb4935bfb",
+        strip_prefix = "zulu25.28.85-ca-jdk25.0.0-win_aarch64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-win_aarch64.zip", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-win_aarch64.zip"],
+        version = "25",
+    ),
+    struct(
+        name = "remotejdk25_win",
+        target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:x86_64"],
+        sha256 = "5efcf4e6a613cae06c8041de8a3695b7346aad0307d397b66bf55281cf1a5cb6",
+        strip_prefix = "zulu25.28.85-ca-jdk25.0.0-win_x64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-win_x64.zip", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu25.28.85-ca-jdk25.0.0-win_x64.zip"],
+        version = "25",
+    ),
 ]
 
 def _make_version_to_remote_jdks():
@@ -369,6 +417,10 @@
     """Imports OpenJDK 21 repositories."""
     _remote_jdk_repos_for_version("21")
 
+def remote_jdk25_repos():
+    """Imports OpenJDK 25 repositories."""
+    _remote_jdk_repos_for_version("25")
+
 def rules_java_dependencies():
     """DEPRECATED: No-op, kept for backwards compatibility"""
     print("DEPRECATED: use rules_java_dependencies() from rules_java_deps.bzl")  # buildifier: disable=print
@@ -384,6 +436,7 @@
     remote_jdk11_repos()
     remote_jdk17_repos()
     remote_jdk21_repos()
+    remote_jdk25_repos()
     java_tools_repos()
 
     native.register_toolchains(
diff --git a/toolchains/BUILD b/toolchains/BUILD
index 9a1b2d3..d6d18bc 100644
--- a/toolchains/BUILD
+++ b/toolchains/BUILD
@@ -353,12 +353,12 @@
     actual = ":toolchain",
 )
 
-RELEASES = (8, 9, 10, 11, 17, 21)
+RELEASES = (8, 9, 10, 11, 17, 21, 25)
 
 [
     default_java_toolchain(
         name = ("toolchain_java%d" if release <= 11 else "toolchain_jdk_%d") % release,
-        configuration = DEFAULT_TOOLCHAIN_CONFIGURATION,
+        configuration = DEFAULT_TOOLCHAIN_CONFIGURATION if release <= 21 else DEFAULT_TOOLCHAIN_CONFIGURATION | {"java_runtime": ":remotejdk_%d" % release},
         source_version = "%s" % release,
         target_version = "%s" % release,
     )
@@ -391,6 +391,12 @@
 )
 
 java_runtime_version_alias(
+    name = "remotejdk_25",
+    runtime_version = "remotejdk_25",
+    visibility = ["//visibility:public"],
+)
+
+java_runtime_version_alias(
     name = "jdk_8",
     runtime_version = "8",
     visibility = ["//visibility:public"],