From 264df8ba634031e212672e06dc8d32b131e086d8 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Mon, 6 Jul 2026 15:26:57 -0400 Subject: [PATCH] Use `SunLimitedUnsafeReflectionProvider` not `SunUnsafeReflectionProvider` on 23+ --- xstream/src/java/com/thoughtworks/xstream/core/JVM.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xstream/src/java/com/thoughtworks/xstream/core/JVM.java b/xstream/src/java/com/thoughtworks/xstream/core/JVM.java index cbefa04e9..27ed00f8b 100644 --- a/xstream/src/java/com/thoughtworks/xstream/core/JVM.java +++ b/xstream/src/java/com/thoughtworks/xstream/core/JVM.java @@ -90,7 +90,9 @@ static class Test { canAllocateWithUnsafe = test; test = false; Class type = PureJavaReflectionProvider.class; - if (canUseSunUnsafeReflectionProvider()) { + if (isVersion(23) && canUseSunUnsafeReflectionProvider()) { + type = loadClassForName("com.thoughtworks.xstream.converters.reflection.SunLimitedUnsafeReflectionProvider"); + } else if (canUseSunUnsafeReflectionProvider()) { Class cls = loadClassForName("com.thoughtworks.xstream.converters.reflection.SunUnsafeReflectionProvider"); if (cls != null) { try {