Skip to content

Commit 7038644

Browse files
committed
When testing on Java 21 and up, enable -XX:+EnableDynamicAgentLoading
This will eliminate console output like: OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended WARNING: A Java agent has been loaded dynamically (/Users/runner/.m2/repository/net/bytebuddy/byte-buddy-agent/1.17.6/byte-buddy-agent-1.17.6.jar) WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information WARNING: Dynamic loading of agents will be disallowed by default in a future release WARNING: A terminally deprecated method in sun.misc.Unsafe has been called WARNING: sun.misc.Unsafe::objectFieldOffset has been called by net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$CreationAction (file:/Users/runner/.m2/repository/net/bytebuddy/byte-buddy/1.17.6/byte-buddy-1.17.6.jar) WARNING: Please consider reporting this to the maintainers of class net.bytebuddy.dynamic.loading.ClassInjector$UsingUnsafe$Dispatcher$CreationAction WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
1 parent 61fb453 commit 7038644

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

pom.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ file comparators, endian transformation classes, and much more.
158158
<commons.jacoco.branchRatio>0.85</commons.jacoco.branchRatio>
159159
<commons.jacoco.lineRatio>0.90</commons.jacoco.lineRatio>
160160
<commons.jacoco.complexityRatio>0.85</commons.jacoco.complexityRatio>
161+
<!-- Java 21 and up -->
162+
<EnableDynamicAgentLoading></EnableDynamicAgentLoading>
161163
</properties>
162164
<build>
163165
<!-- japicmp:cmp needs package to work from a jar -->
@@ -217,7 +219,7 @@ file comparators, endian transformation classes, and much more.
217219
<reuseForks>false</reuseForks>
218220
<!-- Limit memory size see IO-161 -->
219221
<!-- Mockito inline may need -XX:+EnableDynamicAgentLoading -->
220-
<argLine>${argLine} -Xmx25M</argLine>
222+
<argLine>${argLine} -Xmx25M ${EnableDynamicAgentLoading}</argLine>
221223
<includes>
222224
<!-- Only include test classes, not test data -->
223225
<include>**/*Test*.class</include>
@@ -345,6 +347,15 @@ file comparators, endian transformation classes, and much more.
345347
<maven.compiler.release>8</maven.compiler.release>
346348
</properties>
347349
</profile>
350+
<profile>
351+
<id>java21-up</id>
352+
<activation>
353+
<jdk>[21,)</jdk>
354+
</activation>
355+
<properties>
356+
<EnableDynamicAgentLoading>-XX:+EnableDynamicAgentLoading</EnableDynamicAgentLoading>
357+
</properties>
358+
</profile>
348359
<profile>
349360
<!-- Profile to build and run the benchmarks. Use 'mvn test -Pbenchmark', and add '-Dbenchmark=foo' to run only the foo benchmark -->
350361
<id>benchmark</id>

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The <action> type attribute can be add,update,fix,remove.
4747
<body>
4848
<release version="2.20.1" date="YYYY-MM-DD" description="Version 2.20.1: Java 8 or later is required.">
4949
<!-- FIX -->
50+
<action dev="ggregory" type="fix" due-to="Gary Gregory">When testing on Java 21 and up, enable -XX:+EnableDynamicAgentLoading.</action>
5051
<!-- ADD -->
5152
<!-- UPDATE -->
5253
</release>

0 commit comments

Comments
 (0)