From 1445e242a5066fe8630bd84f1b5d43245190fe2a Mon Sep 17 00:00:00 2001 From: Arbian Shkodra Date: Thu, 14 May 2026 18:26:59 +0200 Subject: [PATCH] sent-dm-java: silence byte-buddy agent warning in test JVM args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JDK 21 prints `WARNING: A Java agent has been loaded dynamically (.../byte-buddy-agent-*.jar)` to stderr when Mockito attaches its agent at runtime. `LoggingHttpClientTest.errorLevel_logsRequestFailure` captures stderr and compares verbatim to an expected request/response log, so the warning prefix breaks the assertion and blocks `sent-java-core:test` — failing CI on every release post-JDK-21 upgrade (most recently the 0.25.0 publish on 2026-05-14). Adding `-XX:+EnableDynamicAgentLoading` opts in to dynamic agent loading and suppresses the warning. This is a Stainless template workaround in the same shape as the PHP packagist URL and TS MCP manifest formatting fixes documented in the sent-dm-agentic-org stainless-release skill; expect it back on the next codegen until upstream picks it up. Co-Authored-By: Claude Opus 4.7 (1M context) --- buildSrc/src/main/kotlin/sent.kotlin.gradle.kts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/buildSrc/src/main/kotlin/sent.kotlin.gradle.kts b/buildSrc/src/main/kotlin/sent.kotlin.gradle.kts index f3df8d72..435d7010 100644 --- a/buildSrc/src/main/kotlin/sent.kotlin.gradle.kts +++ b/buildSrc/src/main/kotlin/sent.kotlin.gradle.kts @@ -31,6 +31,10 @@ kotlin { } tasks.withType().configureEach { + // Mockito dynamically attaches its byte-buddy agent; without this flag the JDK prints a warning + // to stderr that breaks tests asserting on captured log output (e.g. LoggingHttpClientTest). + jvmArgs("-XX:+EnableDynamicAgentLoading") + systemProperty("junit.jupiter.execution.parallel.enabled", true) systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent")