RFR: 8344891: Remove uses of sun.misc.ReflectUtil in java.desktop

Alexander Zvegintsev azvegint at openjdk.org
Sat Nov 23 10:54:18 UTC 2024


On Fri, 22 Nov 2024 22:27:32 GMT, Phil Race <prr at openjdk.org> wrote:

> Remove uses of sun.misc.ReflectUtils which checked obsolete permissions

> forName now just calls Class.forName() and since java.desktop uses the same classloader as java.base this is equivalent so can be collapsed to Class.forName directly

I think the same is applicable for the `MethodUtil.getMethod()`, it is now just a wrapper for the `Class.getMethod()`.


./src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java:109:                    Method method = MethodUtil.getMethod(cls, "valueOf", new Class<?>[]{String.class});
./src/java.desktop/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java:456:                    Method method = MethodUtil.getMethod(c.getClass(), s, null);

src/java.desktop/share/classes/javax/swing/UIDefaults.java line 1144:

> 1142:                 }
> 1143:                 c = Class.forName(className, true, (ClassLoader)cl);
> 1144:                 SwingUtilities2.checkAccess(c.getModifiers());

It looks like that it also is no longer needed(+line 1152). Maybe in a separate PR.

-------------

PR Review: https://git.openjdk.org/jdk/pull/22335#pullrequestreview-2456385932
PR Review Comment: https://git.openjdk.org/jdk/pull/22335#discussion_r1855169553


More information about the client-libs-dev mailing list