RFR: 8273581: Change the mechanism by which JDK loads the platform-specific FontManager class [v2]
Phil Race
prr at openjdk.java.net
Wed Sep 15 14:04:51 UTC 2021
On Wed, 15 Sep 2021 07:00:27 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:
>
> Fix typo in sun.font.fontmanager property name. Load AWT lib in test
So it is supposed to be a singleton and that was more strongly enforced in the old code.
Now you have a public per-platform method createFontManager() which always returns a new one.
At the very least I think you shuld make that package protected (it is only accessed from sun.awt, isn't it ?)
and add comments that the method is only to be called via the factory method.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5517
More information about the client-libs-dev
mailing list