diff --git a/.github/workflows/run-all-tests-pr.yml b/.github/workflows/run-all-tests-pr.yml index 8f8663d09..e58a266b8 100644 --- a/.github/workflows/run-all-tests-pr.yml +++ b/.github/workflows/run-all-tests-pr.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: os: [ubuntu-22.04, ubuntu-22.04-arm, windows-2022, macos-15] - jdk: [21, 8] + jdk: [27, 21, 8] include: - jdk: 21 # Workaround for https://github.com/bazelbuild/bazel/issues/14502 diff --git a/MODULE.bazel b/MODULE.bazel index a759ec2c1..65a0e6188 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -15,6 +15,15 @@ bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.2") # TODO: Starting with version 0.28.0 the JUnit test runner is compiled for Java 11 which breaks our JDK 8 tests. # https://github.com/bazel-contrib/rules_jvm/pull/307 bazel_dep(name = "contrib_rules_jvm", version = "0.27.0") + +# java_junit5_test always passes -Djava.security.manager=allow, which JDK 24+ refuses to start with. rules_java already +# passes it to tests on JDK 17 to 23, which need it. +single_version_override( + module_name = "contrib_rules_jvm", + patch_strip = 1, + patches = ["//third_party:contrib_rules_jvm-no-security-manager-flag.patch"], +) + bazel_dep(name = "googletest", version = "1.17.0.bcr.2") bazel_dep(name = "platforms", version = "1.0.0") bazel_dep(name = "protobuf", version = "33.5") @@ -45,9 +54,9 @@ SHADED_RUNTIME_MAVEN_ARTIFACTS = [ "io.github.classgraph:classgraph:4.8.184", "net.bytebuddy:byte-buddy-agent:1.18.4", "net.jodah:typetools:0.6.3", - "org.ow2.asm:asm:9.9.1", - "org.ow2.asm:asm-commons:9.9.1", - "org.ow2.asm:asm-tree:9.9.1", + "org.ow2.asm:asm:9.11.1", + "org.ow2.asm:asm-commons:9.11.1", + "org.ow2.asm:asm-tree:9.11.1", ] # Runtime dependencies of Jazzer that are expected to be provided by the fuzzed project. @@ -424,6 +433,26 @@ REMOTE_JDK21 = [ for jdk in REMOTE_JDK21 ] +remote_jdk27_repos = use_extension("//third_party:jdk_27.bzl", "remote_jdk27_repos") + +REMOTE_JDK27 = [ + "remote_jdk27_linux", + "remote_jdk27_linux_aarch64", + "remote_jdk27_macos", + "remote_jdk27_macos_aarch64", + "remote_jdk27_windows", +] + +[ + use_repo(remote_jdk27_repos, "{}_toolchain_config_repo".format(jdk)) + for jdk in REMOTE_JDK27 +] + +[ + register_toolchains("@{}_toolchain_config_repo//:all".format(jdk)) + for jdk in REMOTE_JDK27 +] + register_toolchains("//bazel/toolchains:kotlin_toolchain") # Used in CI. diff --git a/bazel/tools/java/com/code_intelligence/jazzer/tools/FuzzTargetTestWrapper.java b/bazel/tools/java/com/code_intelligence/jazzer/tools/FuzzTargetTestWrapper.java index dd6a3b846..50d046079 100644 --- a/bazel/tools/java/com/code_intelligence/jazzer/tools/FuzzTargetTestWrapper.java +++ b/bazel/tools/java/com/code_intelligence/jazzer/tools/FuzzTargetTestWrapper.java @@ -56,6 +56,15 @@ public class FuzzTargetTestWrapper { private static final Set IGNORED_WARNINGS = // Triggered by BatikTranscoderFuzzer on macOS in Github Actions. Collections.singleton("WARNING: GL pipe is running in software mode (Renderer ID=0x1020400)"); + // Printed by JDK 24+ when Jazzer uses the memory-access methods of sun.misc.Unsafe (#1069). + private static final Pattern IGNORED_UNSAFE_WARNINGS = + Pattern.compile( + String.join( + "|", + "^WARNING: A terminally deprecated method in sun\\.misc\\.Unsafe has been called", + "^WARNING: sun\\.misc\\.Unsafe::\\w+ has been called by ", + "^WARNING: sun\\.misc\\.Unsafe::\\w+ will be removed in a future release", + "^WARNING: Please consider reporting this to the maintainers of class ")); private static final String EXCEPTION_PREFIX = "== Java Exception: "; private static final String FRAME_PREFIX = "\tat "; private static final Pattern SANITIZER_FINDING = Pattern.compile("^SUMMARY: \\w*Sanitizer"); @@ -137,7 +146,8 @@ public static void main(String[] args) { "-XX:+UseParallelGC", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:+CriticalJNINatives", - "-XX:+EnableDynamicAgentLoading")); + "-XX:+EnableDynamicAgentLoading", + "--enable-native-access=ALL-UNNAMED")); if (System.getenv("JAZZER_DEBUG") != null && System.getenv("JAZZER_DEBUG").equals("1")) { command.add("--debug"); } @@ -258,6 +268,7 @@ private static boolean verifyFuzzerOutput( lines.stream() .filter(line -> line.startsWith("WARN") || line.startsWith("ERROR")) .filter(line -> !IGNORED_WARNINGS.contains(line)) + .filter(line -> !IGNORED_UNSAFE_WARNINGS.matcher(line).find()) .collect(toList()); boolean sawError = warningsAndErrors.stream().anyMatch(line -> line.startsWith("ERROR")); if (!expectedWarningOrError.isPresent() && !warningsAndErrors.isEmpty()) { diff --git a/docs/advanced.md b/docs/advanced.md index a3432685f..b6d7a81b8 100644 --- a/docs/advanced.md +++ b/docs/advanced.md @@ -50,6 +50,13 @@ The following JVM settings are recommended for running Jazzer: instrumentation. * `-XX:+EnableDynamicAgentLoading`: Silences a warning with JDK 21 and later triggered by the Java agent that Jazzer attaches to instrument the fuzzed code. +* `--enable-native-access=ALL-UNNAMED`: Allows Jazzer to load its native libraries. + JDK 24 and later warn without it, and a future JDK will refuse to run Jazzer without it. + +The `jazzer` binary sets these options automatically. +When running fuzz tests with JUnit, pass them to the test JVM together with `-XX:+IgnoreUnrecognizedVMOptions`, so that +each JDK ignores the options it doesn't support, e.g. via `argLine` of the Maven Surefire plugin or `jvmArgs` of the +Gradle `test` task. ## Passing JVM Arguments diff --git a/launcher/jvm_tooling.cpp b/launcher/jvm_tooling.cpp index 2a7384fdf..5a7441b5c 100644 --- a/launcher/jvm_tooling.cpp +++ b/launcher/jvm_tooling.cpp @@ -240,10 +240,13 @@ JVM::JVM() { // Optimize GC for high throughput rather than low latency. options.push_back(JavaVMOption{(char *)"-XX:+UseParallelGC"}); // CriticalJNINatives has been removed in JDK 18, EnableDynamicAgentLoading - // has been added in JDK 9. + // has been added in JDK 9, --enable-native-access in JDK 17. options.push_back(JavaVMOption{(char *)"-XX:+IgnoreUnrecognizedVMOptions"}); options.push_back(JavaVMOption{(char *)"-XX:+CriticalJNINatives"}); options.push_back(JavaVMOption{(char *)"-XX:+EnableDynamicAgentLoading"}); + // Allows Jazzer to load its native libraries, which JDK 24+ otherwise warns + // about and a future JDK will deny. + options.push_back(JavaVMOption{(char *)"--enable-native-access=ALL-UNNAMED"}); #endif std::vector java_opts_args; diff --git a/maven_install.json b/maven_install.json index 1791202f0..e4bce9e4c 100755 --- a/maven_install.json +++ b/maven_install.json @@ -66,9 +66,9 @@ "org.openjdk.jmh:jmh-core": -975784527, "org.openjdk.jmh:jmh-generator-annprocess": -833845560, "org.opentest4j:opentest4j": -1152999839, - "org.ow2.asm:asm": 1206815935, - "org.ow2.asm:asm-commons": 1607605466, - "org.ow2.asm:asm-tree": -1365652182, + "org.ow2.asm:asm": 1350841764, + "org.ow2.asm:asm-commons": 890415337, + "org.ow2.asm:asm-tree": -1086258535, "org.springframework.cloud:spring-cloud-function-context": 191971828, "org.springframework.cloud:spring-cloud-function-core": -1854900684, "org.springframework:spring-messaging": 328550982, @@ -92,10 +92,10 @@ "com.google.guava:listenablefuture": 1079558157, "com.google.j2objc:j2objc-annotations": -1008747351, "com.google.protobuf:protobuf-java": 1555861032, - "com.google.truth.extensions:truth-java8-extension": 1186293162, - "com.google.truth.extensions:truth-liteproto-extension": 2044092816, - "com.google.truth.extensions:truth-proto-extension": -194966365, - "com.google.truth:truth": -1359112801, + "com.google.truth.extensions:truth-java8-extension": -2015579325, + "com.google.truth.extensions:truth-liteproto-extension": -1385654615, + "com.google.truth.extensions:truth-proto-extension": -2008601139, + "com.google.truth:truth": -1509608953, "com.h2database:h2": 475457751, "com.mikesamuel:json-sanitizer": 1715785415, "com.unboundid:unboundid-ldapsdk": -911278373, @@ -148,7 +148,7 @@ "org.glassfish:javax.el": 631698101, "org.hamcrest:hamcrest-core": 649657847, "org.hibernate:hibernate-validator": 1029552718, - "org.jacoco:org.jacoco.core": -1495664227, + "org.jacoco:org.jacoco.core": -1636461585, "org.javassist:javassist": 1095674094, "org.jboss.logging:jboss-logging": 197007362, "org.jetbrains.kotlin:kotlin-reflect": -1292560044, @@ -170,9 +170,9 @@ "org.openjdk.jmh:jmh-core": 262505124, "org.openjdk.jmh:jmh-generator-annprocess": 554503664, "org.opentest4j:opentest4j": -1584531193, - "org.ow2.asm:asm": 1614653533, - "org.ow2.asm:asm-commons": 33716409, - "org.ow2.asm:asm-tree": -1173653421, + "org.ow2.asm:asm": -406993722, + "org.ow2.asm:asm-commons": 1705619162, + "org.ow2.asm:asm-tree": -1950755079, "org.reactivestreams:reactive-streams": -164947187, "org.springframework.boot:spring-boot": 2047288717, "org.springframework.boot:spring-boot-autoconfigure": 1133681824, @@ -766,21 +766,21 @@ }, "org.ow2.asm:asm": { "shasums": { - "jar": "6f3828a215c920059a5efa2fb55c233d6c54ec5cadca99ce1b1bdd10077c7ddd" + "jar": "ae4e6e10d59d0a1500317764b21881ad883f8550e33c66e6142f7032c6fb566c" }, - "version": "9.9.1" + "version": "9.11.1" }, "org.ow2.asm:asm-commons": { "shasums": { - "jar": "c2319e014ce7199f2b7f7d56d6bb991863168c3f4b6cd6c9f542a4937ef7ef88" + "jar": "6a5095ec53726156a78b2cd2efd45bc4e877754eca7c234f61224a53d6bfa661" }, - "version": "9.9.1" + "version": "9.11.1" }, "org.ow2.asm:asm-tree": { "shasums": { - "jar": "0f3555096b720b820bbacab0b515589bee0200bee099bda14c561738ae837ba1" + "jar": "2b15c3c1b288a9fad3bb2cd6d988ba9521554914ed1f2a2029141fa3f483154a" }, - "version": "9.9.1" + "version": "9.11.1" }, "org.reactivestreams:reactive-streams": { "shasums": { diff --git a/src/main/java/com/code_intelligence/jazzer/agent/AgentInstaller.java b/src/main/java/com/code_intelligence/jazzer/agent/AgentInstaller.java index 0ffaede69..e7c715f1b 100644 --- a/src/main/java/com/code_intelligence/jazzer/agent/AgentInstaller.java +++ b/src/main/java/com/code_intelligence/jazzer/agent/AgentInstaller.java @@ -22,6 +22,9 @@ import java.lang.instrument.Instrumentation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import net.bytebuddy.agent.ByteBuddyAgent; @@ -52,11 +55,31 @@ public static void install(boolean enableAgent) { Class agent = Class.forName("com.code_intelligence.jazzer.agent.Agent"); Method install = agent.getMethod("install", Instrumentation.class); install.invoke(null, instrumentation); - } catch (ClassNotFoundException - | InvocationTargetException - | NoSuchMethodException - | IllegalAccessException e) { + } catch (InvocationTargetException e) { + if (isNativeAccessDenied(e)) { + throw new IllegalStateException( + "Jazzer needs native access: add --enable-native-access=ALL-UNNAMED to the JVM" + + " arguments", + e); + } throw new IllegalStateException("Failed to run Agent.install", e); + } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException e) { + throw new IllegalStateException("Failed to run Agent.install", e); + } + } + + // By default, installing the agent loads Jazzer's native library, which fails if the JVM denies + // native access. + static boolean isNativeAccessDenied(Throwable t) { + Set seen = Collections.newSetFromMap(new IdentityHashMap<>()); + for (; t != null && seen.add(t); t = t.getCause()) { + // Compare by name as IllegalCallerException doesn't exist in Java 8, which Jazzer targets. + if (t.getClass().getName().equals("java.lang.IllegalCallerException") + && t.getMessage() != null + && t.getMessage().startsWith("Illegal native access")) { + return true; + } } + return false; } } diff --git a/src/test/java/com/code_intelligence/jazzer/agent/AgentInstallerTest.java b/src/test/java/com/code_intelligence/jazzer/agent/AgentInstallerTest.java new file mode 100644 index 000000000..95edd557b --- /dev/null +++ b/src/test/java/com/code_intelligence/jazzer/agent/AgentInstallerTest.java @@ -0,0 +1,60 @@ +/* + * Copyright 2026 Code Intelligence GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.code_intelligence.jazzer.agent; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeNoException; + +import org.junit.Test; + +public class AgentInstallerTest { + private static Throwable illegalCallerException(String message) { + try { + return (Throwable) + Class.forName("java.lang.IllegalCallerException") + .getConstructor(String.class) + .newInstance(message); + } catch (ReflectiveOperationException e) { + // IllegalCallerException was added in Java 9. + assumeNoException(e); + throw new AssertionError(e); + } + } + + @Test + public void detectsDeniedNativeAccess() { + Throwable denied = illegalCallerException("Illegal native access from an unnamed module"); + assertTrue( + AgentInstaller.isNativeAccessDenied( + new RuntimeException(new ExceptionInInitializerError(denied)))); + } + + @Test + public void ignoresOtherIllegalCallerExceptions() { + Throwable other = illegalCallerException("module java.base does not open java.lang"); + assertFalse(AgentInstaller.isNativeAccessDenied(new RuntimeException(other))); + } + + @Test(timeout = 10_000) + public void handlesCyclicCauses() { + RuntimeException first = new RuntimeException(); + RuntimeException second = new RuntimeException(first); + first.initCause(second); + assertFalse(AgentInstaller.isNativeAccessDenied(first)); + } +} diff --git a/src/test/java/com/code_intelligence/jazzer/agent/BUILD.bazel b/src/test/java/com/code_intelligence/jazzer/agent/BUILD.bazel new file mode 100644 index 000000000..607dde574 --- /dev/null +++ b/src/test/java/com/code_intelligence/jazzer/agent/BUILD.bazel @@ -0,0 +1,35 @@ +[ + java_test( + name = name, + srcs = ["NativeAccessTest.java"], + args = args, + jvm_flags = [ + "-XX:+IgnoreUnrecognizedVMOptions", + "--illegal-native-access=deny", + ], + main_class = "com.code_intelligence.jazzer.agent.NativeAccessTest", + use_testrunner = False, + deps = [ + "//src/main/java/com/code_intelligence/jazzer/agent:agent_installer", + # Provides Jazzer's native library. + "//src/main/java/com/code_intelligence/jazzer/driver:fuzz_target_runner", + ], + ) + for name, args in [ + ("NativeAccessTest", []), + ( + "NativeAccessWithoutAgentTest", + ["--without_agent"], + ), + ] +] + +java_test( + name = "AgentInstallerTest", + size = "small", + srcs = ["AgentInstallerTest.java"], + deps = [ + "//src/main/java/com/code_intelligence/jazzer/agent:agent_installer", + "@maven//:junit_junit", + ], +) diff --git a/src/test/java/com/code_intelligence/jazzer/agent/NativeAccessTest.java b/src/test/java/com/code_intelligence/jazzer/agent/NativeAccessTest.java new file mode 100644 index 000000000..e288fa7b9 --- /dev/null +++ b/src/test/java/com/code_intelligence/jazzer/agent/NativeAccessTest.java @@ -0,0 +1,43 @@ +/* + * Copyright 2026 Code Intelligence GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.code_intelligence.jazzer.agent; + +import java.util.Arrays; + +/** Runs with native access denied, see BUILD.bazel. */ +public class NativeAccessTest { + public static void main(String[] args) { + boolean enableAgent = !Arrays.asList(args).contains("--without_agent"); + String version = System.getProperty("java.specification.version"); + // Older JDKs ignore --illegal-native-access, which was added in JDK 24. + boolean nativeAccessDenied = !version.startsWith("1.") && Integer.parseInt(version) >= 24; + // By default, installing the agent loads Jazzer's native library. Without the agent, e.g. in + // JUnit regression tests with hooks disabled, no native access is needed. + boolean expectFailure = enableAgent && nativeAccessDenied; + try { + AgentInstaller.install(enableAgent); + } catch (IllegalStateException e) { + if (expectFailure && e.getMessage().contains("--enable-native-access=ALL-UNNAMED")) { + return; + } + throw e; + } + if (expectFailure) { + throw new IllegalStateException("Expected AgentInstaller.install to fail"); + } + } +} diff --git a/src/test/java/com/code_intelligence/jazzer/instrumentor/BUILD.bazel b/src/test/java/com/code_intelligence/jazzer/instrumentor/BUILD.bazel index 126e10d1c..cbcc4e0fd 100644 --- a/src/test/java/com/code_intelligence/jazzer/instrumentor/BUILD.bazel +++ b/src/test/java/com/code_intelligence/jazzer/instrumentor/BUILD.bazel @@ -86,6 +86,25 @@ wrapped_kt_jvm_test( ], ) +wrapped_kt_jvm_test( + name = "class_file_version_test", + size = "small", + srcs = [ + "ClassFileVersionTest.kt", + "CoverageInstrumentationTarget.java", + "MockCoverageMap.java", + ], + associates = [ + "//src/main/java/com/code_intelligence/jazzer/instrumentor:instrumentor", + ], + test_class = "com.code_intelligence.jazzer.instrumentor.ClassFileVersionTest", + deps = [ + ":patch_test_utils", + "@maven//:junit_junit", + "@rules_kotlin//kotlin/compiler:kotlin-test", + ], +) + wrapped_kt_jvm_test( name = "hook_validation_test", size = "small", diff --git a/src/test/java/com/code_intelligence/jazzer/instrumentor/ClassFileVersionTest.kt b/src/test/java/com/code_intelligence/jazzer/instrumentor/ClassFileVersionTest.kt new file mode 100644 index 000000000..4dffa5b01 --- /dev/null +++ b/src/test/java/com/code_intelligence/jazzer/instrumentor/ClassFileVersionTest.kt @@ -0,0 +1,52 @@ +/* + * Copyright 2026 Code Intelligence GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.code_intelligence.jazzer.instrumentor + +import com.code_intelligence.jazzer.instrumentor.PatchTestUtils.classToBytecode +import org.junit.Test +import kotlin.test.assertEquals + +class ClassFileVersionTest { + private fun withMajorVersion( + bytecode: ByteArray, + majorVersion: Int, + ): ByteArray = + bytecode.copyOf().also { + it[6] = (majorVersion shr 8).toByte() + it[7] = majorVersion.toByte() + } + + @Test + fun testInstrumentsJava27And28ClassFiles() { + val internalClassName = CoverageInstrumentationTarget::class.java.name.replace('.', '/') + val original = classToBytecode(CoverageInstrumentationTarget::class.java) + // Major versions of Java 27 and 28. + for (majorVersion in listOf(71, 72)) { + val instrumentors = + listOf( + EdgeCoverageInstrumentor(StaticMethodStrategy(), MockCoverageMap::class.java, 0), + TraceDataFlowInstrumentor(InstrumentationType.values().toSet()), + HookInstrumentor(emptyList(), java6Mode = false, classWithHooksEnabledField = null), + ) + val instrumented = + instrumentors.fold(sortMethods(withMajorVersion(original, majorVersion))) { bytecode, instrumentor -> + instrumentor.instrument(internalClassName, bytecode) + } + assertEquals(majorVersion, extractClassFileMajorVersion(instrumented)) + } + } +} diff --git a/third_party/contrib_rules_jvm-no-security-manager-flag.patch b/third_party/contrib_rules_jvm-no-security-manager-flag.patch new file mode 100644 index 000000000..fcbb4a50f --- /dev/null +++ b/third_party/contrib_rules_jvm-no-security-manager-flag.patch @@ -0,0 +1,16 @@ +--- a/java/private/junit5.bzl ++++ b/java/private/junit5.bzl +@@ -91,13 +91,6 @@ + if exclude_engines: + jvm_flags = jvm_flags + ["-DJUNIT5_EXCLUDE_ENGINES=%s" % ",".join(exclude_engines)] + +- security_manager_flag_seen = False +- for flag in jvm_flags: +- if flag.startswith("-Djava.security.manager="): +- security_manager_flag_seen = True +- if not security_manager_flag_seen: +- jvm_flags = jvm_flags + ["-Djava.security.manager=allow"] +- + java_test( + name = name, + main_class = "com.github.bazel_contrib.contrib_rules_jvm.junit5.JUnit5Runner", diff --git a/third_party/jdk_27.bzl b/third_party/jdk_27.bzl new file mode 100644 index 000000000..6c05cd905 --- /dev/null +++ b/third_party/jdk_27.bzl @@ -0,0 +1,88 @@ +# +# Copyright 2026 Code Intelligence GmbH +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +load("@rules_java//toolchains:remote_java_repository.bzl", "remote_java_repository") + +# rules_java doesn't provide JDK 27, which is used to test Jazzer on the latest JDK. +def _remote_jdk27_repos(_): + remote_java_repository( + name = "remote_jdk27_linux", + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], + sha256 = "c4d7bf4c80a21e935187ecdcb111e4b2f14e1fdd18364974fe7f7da54b12bea0", + strip_prefix = "zulu27.30.201-ca-jdk27.0.1.1-linux_x64", + urls = [ + "https://cdn.azul.com/zulu/bin/zulu27.30.201-ca-jdk27.0.1.1-linux_x64.tar.gz", + ], + version = "27", + ) + remote_java_repository( + name = "remote_jdk27_linux_aarch64", + target_compatible_with = [ + "@platforms//os:linux", + "@platforms//cpu:aarch64", + ], + sha256 = "18875b92ad2535230a13175f718933f7cc0593b4affa2dab442815ec245dacbb", + strip_prefix = "zulu27.30.201-ca-jdk27.0.1.1-linux_aarch64", + urls = [ + "https://cdn.azul.com/zulu/bin/zulu27.30.201-ca-jdk27.0.1.1-linux_aarch64.tar.gz", + ], + version = "27", + ) + remote_java_repository( + name = "remote_jdk27_macos_aarch64", + target_compatible_with = [ + "@platforms//os:macos", + "@platforms//cpu:aarch64", + ], + sha256 = "1d28430a13d257248856792e0131d845cbe324145971df7c9716ec2a92ac0fca", + # Unlike older Zulu releases, the macOS archives contain an app bundle. + strip_prefix = "zulu27.30.201-ca-jdk27.0.1.1-macosx_aarch64/Contents/Home", + urls = [ + "https://cdn.azul.com/zulu/bin/zulu27.30.201-ca-jdk27.0.1.1-macosx_aarch64.tar.gz", + ], + version = "27", + ) + remote_java_repository( + name = "remote_jdk27_macos", + target_compatible_with = [ + "@platforms//os:macos", + "@platforms//cpu:x86_64", + ], + sha256 = "271f8d1bb2f692bdc981799e8f251133c854cc5c1edafa80298a461bb8909dec", + strip_prefix = "zulu27.30.201-ca-jdk27.0.1.1-macosx_x64/Contents/Home", + urls = [ + "https://cdn.azul.com/zulu/bin/zulu27.30.201-ca-jdk27.0.1.1-macosx_x64.tar.gz", + ], + version = "27", + ) + remote_java_repository( + name = "remote_jdk27_windows", + target_compatible_with = [ + "@platforms//os:windows", + "@platforms//cpu:x86_64", + ], + sha256 = "f5424ea36f832aa28a0441a57ffb1dfe2cd3d903802c0a36d22576b1acc430ec", + strip_prefix = "zulu27.30.201-ca-jdk27.0.1.1-win_x64", + urls = [ + "https://cdn.azul.com/zulu/bin/zulu27.30.201-ca-jdk27.0.1.1-win_x64.zip", + ], + version = "27", + ) + +remote_jdk27_repos = module_extension(_remote_jdk27_repos)