RFR: 8344059: Remove doPrivileged calls from windows platform sources in the java.desktop module [v3]

Prasanta Sadhukhan psadhukhan at openjdk.org
Fri Nov 15 03:29:13 UTC 2024


On Thu, 14 Nov 2024 18:08:34 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove GetPropertyAction
>
> src/java.desktop/windows/classes/sun/awt/Win32FontManager.java line 48:
> 
>> 46: public final class Win32FontManager extends SunFontManager {
>> 47: 
>> 48:     private static TrueTypeFont eudcFont;
> 
> Minor: This can still be kept final by using a local variable (initialized to null) in the static block and assigning this field to that local variable once at the end of the block.
> 
> Alternatively, you can use a `Supplier<TrueTypeFont>` lambda and make even fewer changes (it will be closer to the original). Something like this, which we did in a couple places in FX:
> 
> 
>         private static final TrueTypeFont eudcFont =
>             ((Supplier<TrueTypeFont>) () -> {
>                 String eudcFile = getEUDCFontFile();
>                 if (eudcFile != null) {
>                     try {
>                         /* Must use Java rasteriser since GDI doesn't
>                          * enumerate (allow direct use) of EUDC fonts.
>                          */
>                         return new TrueTypeFont(eudcFile, null, 0,
>                                                     true, false);
>                     } catch (FontFormatException e) {
>                     }
>                 }
>                 return null;
>             }).get();

ok..will be using this then..Thanks..

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22083#discussion_r1843141049


More information about the client-libs-dev mailing list