Skip to content

Commit f314818

Browse files
committed
Disable unsafe dispatcher by default when run on Java 25 or later.
1 parent 887d93a commit f314818

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,9 @@ protected UsingUnsafeInjection(Object accessor,
987987
*/
988988
@SuppressFBWarnings(value = "DP_DO_INSIDE_DO_PRIVILEGED", justification = "Assuring privilege is explicit user responsibility.")
989989
protected static Initializable make() throws Exception {
990-
if (Boolean.parseBoolean(java.lang.System.getProperty(UsingUnsafe.SAFE_PROPERTY, Boolean.toString(GraalImageCode.getCurrent().isDefined())))) {
990+
if (Boolean.parseBoolean(java.lang.System.getProperty(UsingUnsafe.SAFE_PROPERTY, Boolean.toString(ClassFileVersion
991+
.ofThisVm()
992+
.isAtLeast(ClassFileVersion.JAVA_V25) || GraalImageCode.getCurrent().isDefined())))) {
991993
return new Initializable.Unavailable("Use of Unsafe was disabled by system property");
992994
}
993995
Class<?> unsafe = Class.forName("sun.misc.Unsafe");

0 commit comments

Comments
 (0)