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

Phil Race prr at openjdk.org
Sat Nov 23 17:25:19 UTC 2024


On Sat, 23 Nov 2024 10:52:00 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

> > 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);
> ```

This PR is just about ReflectUtils.

> 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());
> 
> Suggestion:
> 
> 
> 
> It looks like that it also is no longer needed(+line 1152). Maybe in a separate PR.

Yes, this PR is just about ReflectUtils so this case will be handled in a separate PR

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

PR Comment: https://git.openjdk.org/jdk/pull/22335#issuecomment-2495547646
PR Review Comment: https://git.openjdk.org/jdk/pull/22335#discussion_r1855230289


More information about the client-libs-dev mailing list