RFR: 8375480: Remove usage of AppContext from javax/swing/text [v2]
Phil Race
prr at openjdk.org
Tue Jan 20 20:44:34 UTC 2026
On Tue, 20 Jan 2026 17:00:29 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> Some consideration might be needed. It should be taken into account that using AppContext.get/put/remove indirectly causes synchronization points, so everything written before getAppContext becomes visible after.
>
> It would probably be better to use LazyConstants for all of this instead of moving everything into a static block and loading everything eagerly.
I looked at the change that introduced AppContext here and I simply reverted it.
https://hg.openjdk.org/jdk7/jdk7/jdk/rev/9ed7ae1e911c
So as far as I can tell, thread safety was never a guarantee here.
And the containing package doc
https://docs.oracle.com/en/java/javase/25/docs/api/java.desktop/javax/swing/text/html/package-summary.html
Says "Most of the Swing API is not thread safe...."
I don't understaand the comment about LazyConstants.
The Stylesheet is not being eagerly created.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29259#discussion_r2709997875
More information about the client-libs-dev
mailing list