8383639: JConsole unnecessary classloading for MBean types

Reviewed-by: cjplummer, sspitsyn
This commit is contained in:
Kevin Walls 2026-05-05 09:57:00 +00:00
parent 65670ba43b
commit ea40bcaaaa

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -123,7 +123,10 @@ public class Utils {
if ((c = primitiveMap.get(className)) != null) {
return c;
}
return Class.forName(className);
if (editableTypes.contains(className)) {
return Class.forName(className);
}
return Object.class; // No need to load class.
}
/**
@ -216,7 +219,7 @@ public class Utils {
className = className.substring(2, className.length() - 1);
} else {
try {
Class<?> c = Class.forName(className);
Class<?> c = Utils.getClass(className);
className = c.getComponentType().getName();
} catch (ClassNotFoundException e) {
// Should not happen