RFR: 8344060: Remove doPrivileged calls from shared implementation code in the java.desktop module : part 1 [v2]

Phil Race prr at openjdk.org
Tue Nov 19 19:23:52 UTC 2024


On Fri, 15 Nov 2024 20:17:57 GMT, Phil Race <prr at openjdk.org> wrote:

>> src/java.desktop/share/classes/sun/swing/SwingUtilities2.java line 1708:
>> 
>>> 1706:         return (UIDefaults.LazyValue) (table) -> {
>>> 1707:             byte[] buffer = enablePrivileges ?
>>> 1708:                     getIconBytes(baseClass, rootClass, imageFile)
>> 
>> Suggestion:
>> 
>>             byte[] buffer = getIconBytes(baseClass, rootClass, imageFile);
>> 
>> 
>> Maybe you could move the method body to `makeIcon(Class<?>, Class<?>, String)`
>
> This enablePrivileges param is interesting and obsolete.
> Either here or in an immediate follow-on we should get rid of it.
> I'm inclined to do it in a small follow-on, not here.
> javax.swing.LookAndFeel.makeIcon(.) is the only place that calls
>  SwingUtilities2.makeIcon_Unprivileged so it won't be hard.

I submitted https://bugs.openjdk.org/browse/JDK-8344569

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22133#discussion_r1848940296


More information about the client-libs-dev mailing list