RFR: 8376423: Test javax/swing/plaf/metal/MetalUtils/bug6190373.java failed: ClassCastException: class java.lang.Character cannot be cast to class javax.swing.Painter

Phil Race prr at openjdk.org
Tue Jan 27 18:13:14 UTC 2026


On Tue, 27 Jan 2026 16:31:23 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> AppContext is removed from Swing LAF state. Tests which require it are deleted.
>
> src/java.desktop/share/classes/javax/swing/UIManager.java line 247:
> 
>> 245:      */
>> 246:     private static LAFState getLAFState() {
>> 247:         return LAF_STATE;
> 
> I think you still have to use `synchronized (classLock)`, otherwise `LAF_STATE.initialized` in `isLafStateInitialized` could return a stale value.

The existing code only used that when creating the instance, not when retrieving an already created instance, so I don't see why we'd need to extend the lock to the retrieval.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29437#discussion_r2733242279


More information about the client-libs-dev mailing list