On Sat, 18 Oct 2025 02:48:42 GMT, Chen Liang <[email protected]> wrote:

>> By annotating `SharedSecrets` as `@AOTSafeClassInitializer`, we can avoid 
>> using the `@AOTRuntimeSetup` annotations in a few JDK core classes. This 
>> simplifies the implementation. It also brings us closer to the goal of 
>> making the AOT cache as a true snapshot of the JVM state that just needs to 
>> be resumed in the production run.
>
> src/java.base/share/classes/jdk/internal/access/SharedSecrets.java line 69:
> 
>> 67: public class SharedSecrets {
>> 68:     // This field is not necessarily stable
>> 69:     private static JavaAWTFontAccess javaAWTFontAccess;
> 
> Does aot initialization work with this field?

I think this field is safe. There are two places that could set it, but they 
will always set it to an instance of `JavaAWTFontAccessImpl`, which is 
stateless.

https://github.com/openjdk/jdk/blob/eff6439e75d79c67370e79638024296e01101b48/src/java.desktop/share/classes/java/awt/font/NumericShaper.java#L148-L149

https://github.com/openjdk/jdk/blob/eff6439e75d79c67370e79638024296e01101b48/src/java.desktop/share/classes/java/awt/font/TextAttribute.java#L251-L252

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27880#discussion_r2441561760

Reply via email to