Update JDK 21 binaries

Copybara Import from https://github.com/bazelbuild/rules_java/pull/223

BEGIN_PUBLIC
Update JDK 21 binaries (#223)

Also switch to Zulu for Windows ARM64.

Closes #223
END_PUBLIC

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/223 from fmeum:update-21 317efb24b1579d510096cda87c622dbbfe93bdad
PiperOrigin-RevId: 675977860
Change-Id: I4c80be97f4e3530725ba26e9374d0352bed08cf9
diff --git a/java/bazel/BUILD.bazel b/java/bazel/BUILD.bazel
index 21bd34c..b5ddea9 100644
--- a/java/bazel/BUILD.bazel
+++ b/java/bazel/BUILD.bazel
@@ -13,7 +13,7 @@
 # limitations under the License.
 load(":repositories_util.bzl", "FLAT_CONFIGS")
 
-# run this to generate _REMOTE_JDK_CONFIGS_LIST in repositories.bzl
+# build this to generate _REMOTE_JDK_CONFIGS_LIST in repositories.bzl
 # this downloads all the jdks and computes their sha256 sum, so can take a while
 # TODO(hvd): make this a sh_binary to update the configs in place
 genrule(
diff --git a/java/bazel/repositories_util.bzl b/java/bazel/repositories_util.bzl
index d895fc2..7e9efbd 100644
--- a/java/bazel/repositories_util.bzl
+++ b/java/bazel/repositories_util.bzl
@@ -72,31 +72,24 @@
     },
     "21": {
         "zulu": {
-            "release": "21.34.19-ca-jdk21.0.3",
+            "release": "21.36.17-ca-jdk21.0.4",
             "platforms": {
                 "linux": ["aarch64", "x86_64"],
                 "macos": ["aarch64", "x86_64"],
-                "windows": ["x86_64"],
+                "windows": ["arm64", "x86_64"],
             },
         },
         "adoptium": {
-            "release": "21.0.2+13",
+            "release": "21.0.4+7",
             "platforms": {
                 "linux": ["ppc", "s390x"],
             },
         },
-        "microsoft": {
-            "release": "21.0.0",
-            "platforms": {
-                "windows": ["arm64"],
-            },
-        },
     },
 }
 
 _STRIP_PREFIX_OVERRIDES = {
     "remotejdk11_win_arm64": "jdk-11.0.13+8",
-    "remotejdk21_win_arm64": "jdk-21+35",
 }
 
 def _name_for_remote_jdk(version, os, cpu):
diff --git a/java/repositories.bzl b/java/repositories.bzl
index c8156bd..37a0d31 100644
--- a/java/repositories.bzl
+++ b/java/repositories.bzl
@@ -74,7 +74,7 @@
     )
 
 # DO NOT MANUALLY UPDATE! Update java/bazel/repositories_util.bzl instead and
-# run the java/bazel:dump_remote_jdk_configs target to generate this list
+# build the java/bazel:dump_remote_jdk_configs target to generate this list
 _REMOTE_JDK_CONFIGS_LIST = [
     struct(
         name = "remote_jdk8_linux_aarch64",
@@ -255,65 +255,65 @@
     struct(
         name = "remotejdk21_linux_aarch64",
         target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:aarch64"],
-        sha256 = "c898d4ce365c8926e22859c06be4a81bafb9fd0126088867e15a528fe99b1599",
-        strip_prefix = "zulu21.34.19-ca-jdk21.0.3-linux_aarch64",
-        urls = ["https://cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-linux_aarch64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-linux_aarch64.tar.gz"],
+        sha256 = "da3c2d7db33670bcf66532441aeb7f33dcf0d227c8dafe7ce35cee67f6829c4c",
+        strip_prefix = "zulu21.36.17-ca-jdk21.0.4-linux_aarch64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-linux_aarch64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-linux_aarch64.tar.gz"],
         version = "21",
     ),
     struct(
         name = "remotejdk21_linux",
         target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:x86_64"],
-        sha256 = "ca763d1308a6bcc768382f160733a08e591d5f595a7dd9e51b60d27d54828dcc",
-        strip_prefix = "zulu21.34.19-ca-jdk21.0.3-linux_x64",
-        urls = ["https://cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-linux_x64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-linux_x64.tar.gz"],
+        sha256 = "318d0c2ed3c876fb7ea2c952945cdcf7decfb5264ca51aece159e635ac53d544",
+        strip_prefix = "zulu21.36.17-ca-jdk21.0.4-linux_x64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-linux_x64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-linux_x64.tar.gz"],
         version = "21",
     ),
     struct(
         name = "remotejdk21_macos_aarch64",
         target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:aarch64"],
-        sha256 = "4f42a561909d71868a700cf2efa1390e1b9e04863f3fa75ea30c4965e5a702f0",
-        strip_prefix = "zulu21.34.19-ca-jdk21.0.3-macosx_aarch64",
-        urls = ["https://cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-macosx_aarch64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-macosx_aarch64.tar.gz"],
+        sha256 = "bc2750f81a166cc6e9c30ae8aaba54f253a8c8ec9d8cfc04a555fe20712c7bff",
+        strip_prefix = "zulu21.36.17-ca-jdk21.0.4-macosx_aarch64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-macosx_aarch64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-macosx_aarch64.tar.gz"],
         version = "21",
     ),
     struct(
         name = "remotejdk21_macos",
         target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:x86_64"],
-        sha256 = "148006a220a18922d7a9c52ac0bad099c5b4e60334a8d02b11f8c945e9ec9a34",
-        strip_prefix = "zulu21.34.19-ca-jdk21.0.3-macosx_x64",
-        urls = ["https://cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-macosx_x64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-macosx_x64.tar.gz"],
-        version = "21",
-    ),
-    struct(
-        name = "remotejdk21_win",
-        target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:x86_64"],
-        sha256 = "fb9f0dc6a484b0b169b3b3a3c2425d5f62bebfd15cb06c1597e33f77959c72af",
-        strip_prefix = "zulu21.34.19-ca-jdk21.0.3-win_x64",
-        urls = ["https://cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-win_x64.zip", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-win_x64.zip"],
-        version = "21",
-    ),
-    struct(
-        name = "remotejdk21_linux_ppc64le",
-        target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:ppc"],
-        sha256 = "d08de863499d8851811c893e8915828f2cd8eb67ed9e29432a6b4e222d80a12f",
-        strip_prefix = "jdk-21.0.2+13",
-        urls = ["https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.2_13.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.2_13.tar.gz"],
-        version = "21",
-    ),
-    struct(
-        name = "remotejdk21_linux_s390x",
-        target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:s390x"],
-        sha256 = "0d5676c50821e0d0b951bf3ffd717e7a13be2a89d8848a5c13b4aedc6f982c78",
-        strip_prefix = "jdk-21.0.2+13",
-        urls = ["https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.2_13.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.2_13.tar.gz"],
+        sha256 = "5ce75a6a247c7029b74c4ca7cf6f60fd2b2d68ce1e8956fb448d2984316b5fea",
+        strip_prefix = "zulu21.36.17-ca-jdk21.0.4-macosx_x64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-macosx_x64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-macosx_x64.tar.gz"],
         version = "21",
     ),
     struct(
         name = "remotejdk21_win_arm64",
         target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:arm64"],
-        sha256 = "975603e684f2ec5a525b3b5336d6aa0b09b5b7d2d0d9e271bd6a9892ad550181",
-        strip_prefix = "jdk-21+35",
-        urls = ["https://aka.ms/download-jdk/microsoft-jdk-21.0.0-windows-aarch64.zip", "https://mirror.bazel.build/aka.ms/download-jdk/microsoft-jdk-21.0.0-windows-aarch64.zip"],
+        sha256 = "9f873eccf030b1d3dc879ec1eb0ff5e11bf76002dc81c5c644c3462bf6c5146b",
+        strip_prefix = "zulu21.36.17-ca-jdk21.0.4-win_aarch64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-win_aarch64.zip", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-win_aarch64.zip"],
+        version = "21",
+    ),
+    struct(
+        name = "remotejdk21_win",
+        target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:x86_64"],
+        sha256 = "d771dad10d3f0b440c3686d1f3d2b68b320802ac97b212d87671af3f2eef8848",
+        strip_prefix = "zulu21.36.17-ca-jdk21.0.4-win_x64",
+        urls = ["https://cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-win_x64.zip", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.36.17-ca-jdk21.0.4-win_x64.zip"],
+        version = "21",
+    ),
+    struct(
+        name = "remotejdk21_linux_ppc64le",
+        target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:ppc"],
+        sha256 = "c208cd0fb90560644a90f928667d2f53bfe408c957a5e36206585ad874427761",
+        strip_prefix = "jdk-21.0.4+7",
+        urls = ["https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4+7/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.4_7.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4+7/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.4_7.tar.gz"],
+        version = "21",
+    ),
+    struct(
+        name = "remotejdk21_linux_s390x",
+        target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:s390x"],
+        sha256 = "c900c8d64fab1e53274974fa4a4c736a5a3754485a5c56f4947281480773658a",
+        strip_prefix = "jdk-21.0.4+7",
+        urls = ["https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4+7/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.4_7.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.4+7/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.4_7.tar.gz"],
         version = "21",
     ),
 ]
diff --git a/test/check_remote_jdk_configs.sh b/test/check_remote_jdk_configs.sh
index ab42ba1..1b58c96 100755
--- a/test/check_remote_jdk_configs.sh
+++ b/test/check_remote_jdk_configs.sh
@@ -21,15 +21,15 @@
     IFS=, read -r name url mirror_url hash strip_prefix <<< "${config}"
     echo "fetching $name from $url to ${TMP_FILE}"
     curl --silent -o ${TMP_FILE} -L "$url"
-    actual_hash=`sha256sum ${TMP_FILE} | cut -d' ' -f1`
+    actual_hash=$(sha256sum ${TMP_FILE} | cut -d' ' -f1)
     if [ "${hash}" != "${actual_hash}" ]; then
       echo "ERROR: wrong hash for ${name}! wanted: ${hash}, got: ${actual_hash}"
       exit 1
     fi
     if [[ -z "${url##*.tar.gz}" ]]; then
-      root_dir=`tar ztf ${TMP_FILE} --exclude='*/*'`
+      root_dir=$(tar ztf ${TMP_FILE} --exclude='*/*')
     elif [[ -z "${url##*.zip}" ]]; then
-      root_dir=`unzip -Z1 ${TMP_FILE} | head -n1`
+      root_dir=$(unzip -Z1 ${TMP_FILE} | head -n1)
     else
       echo "ERROR: unexpected archive type for ${name}"
       exit 1
@@ -40,7 +40,7 @@
     fi
     if [[ -n "${mirror_url}" ]]; then
       echo "checking mirror: ${mirror_url}"
-      curl --silent --fail -I -L ${mirror_url} > /dev/null || { _MISSING_MIRRORS+="${mirror_url}"; }
+      curl --silent --fail -I -L ${mirror_url} > /dev/null || { _MISSING_MIRRORS+=("${mirror_url}"); }
     fi
 done