RFR: 8375480: Remove usage of AppContext from javax/swing/text

Sergey Bylokhov serb at openjdk.org
Tue Jan 20 17:03:34 UTC 2026


On Tue, 20 Jan 2026 09:41:09 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java line 434:
>> 
>>> 432:      */
>>> 433:     public void setStyleSheet(StyleSheet s) {
>>> 434:         defaultStyles = s;
>> 
>> Dont we need to add `synchronized` for setter and getter? getAppContext used to use getAppContextLock!!
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29259#discussion_r2709254708


More information about the client-libs-dev mailing list