You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by zi...@apache.org on 2026/08/19 02:34:44 UTC
(pulsar) branch master updated: [improve][build] Set --enable-native-access=ALL-UNNAMED for test JVMs on Java 24+ (#26367)
This is an automated email from the ASF dual-hosted git repository.
nodece pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 81936d57ee9c [improve][build] Set --enable-native-access=ALL-UNNAMED for test JVMs on Java 24+ (#26367)
81936d57ee9c is described below
commit 81936d57ee9ce9396faddb41f653fbf9d34c2a08
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Wed Aug 19 05:34:38 2026 +0300
[improve][build] Set --enable-native-access=ALL-UNNAMED for test JVMs on Java 24+ (#26367)
---
.../src/main/kotlin/pulsar.java-conventions.gradle.kts | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/build-logic/conventions/src/main/kotlin/pulsar.java-conventions.gradle.kts b/build-logic/conventions/src/main/kotlin/pulsar.java-conventions.gradle.kts
index d9bc7758fde5..57fae76e8b6c 100644
--- a/build-logic/conventions/src/main/kotlin/pulsar.java-conventions.gradle.kts
+++ b/build-logic/conventions/src/main/kotlin/pulsar.java-conventions.gradle.kts
@@ -198,6 +198,9 @@ dependencies {
// Allow overriding the JDK used for running tests via -PtestJavaVersion=17
val testJavaVersion = providers.gradleProperty("testJavaVersion").map { it.toInt() }
val javaToolchains = extensions.getByType<JavaToolchainService>()
+// Effective Java major version used to run tests: the -PtestJavaVersion override when set,
+// otherwise the JVM running Gradle.
+val testJavaMajorVersion = testJavaVersion.orNull ?: JavaVersion.current().majorVersion.toInt()
tasks.withType<Test>().configureEach {
testJavaVersion.orNull?.let { version ->
@@ -261,6 +264,13 @@ tasks.withType<Test>().configureEach {
// loopback would otherwise fail to start.
"-Djava.net.preferIPv4Stack=true",
)
+ if (testJavaMajorVersion >= 24) {
+ // Netty loads its native libraries (epoll, io_uring, tcnative) through
+ // java.lang.System::loadLibrary, which is a restricted method as of Java 24. Without this
+ // every test JVM that touches a Netty native transport prints a multi-line warning to
+ // stderr, which is noise in test output and breaks assertions on empty stderr.
+ jvmArgs("--enable-native-access=ALL-UNNAMED")
+ }
}
// Expose test classes for cross-module test dependencies (Maven test-jar equivalent)