RFR: 8273581: Change the mechanism by which JDK loads the platform-specific FontManager class [v3]

Sergey Bylokhov serb at openjdk.java.net
Fri Sep 17 08:06:44 UTC 2021


On Thu, 16 Sep 2021 13:38:37 GMT, Alexander Scherbatiy <alexsch at openjdk.org> wrote:

>> FontManagerFactory class uses reflection to load platform specific FontManager classes from "sun.font.fontmanager" property.
>> 
>> Fix proposes creating FontManager platform specific classes directly in the similar way as it has been already done for GraphicsEnvironment and AWT Toolkit ([JDK-8130266](https://bugs.openjdk.java.net/browse/JDK-8130266) and [JDK-8212700](https://bugs.openjdk.java.net/browse/JDK-8212700)).
>> 
>> FontManager is internal jdk class. It is placed in `sun.font` package and java modularization encapsulates  FontManager from subclassing and using by a user.
>> 
>> The fix reuses PlatformGraphicsInfo to create FontManager platform specific classes. May be FontManager creation code needs to be placed in its own info classes.
>
> Alexander Scherbatiy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Move createFontManager() code to sun.font.PlatformFontInfo class

src/java.desktop/share/classes/sun/font/FontManagerFactory.java line 54:

> 52:      * @return a valid FontManager instance for the current platform
> 53:      */
> 54:     @SuppressWarnings("removal")

Suppress is not needed anymore?

src/java.desktop/share/classes/sun/font/FontManagerFactory.java line 55:

> 53:      */
> 54:     @SuppressWarnings("removal")
> 55:     public static synchronized FontManager getInstance() {

Just an idea, since the method became so small can we use DLC here instead of synchronised static method?

test/jdk/sun/awt/font/CheckFontManagerSystemProperty.java line 35:

> 33: 
> 34:     public static void main(String[] args) {
> 35:         // force AWT library loading

Do we need the headful or headless libraries?

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

PR: https://git.openjdk.java.net/jdk/pull/5517



More information about the client-libs-dev mailing list