On Thu, 26 Mar 2026 20:55:26 GMT, Phil Race <[email protected]> wrote:

> There are some remaining scattered uses of AppContext in AWT classes.
> src/java.desktop/share/classes/java/awt/EventDispatchThread.java
> src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java
> src/java.desktop/share/classes/java/awt/SentEvent.java
> src/java.desktop/share/classes/java/awt/WaitDispatchSupport.java
> src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java
> src/java.desktop/share/classes/sun/awt/GlobalCursorManager.java
> src/java.desktop/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java
> src/java.desktop/share/classes/sun/awt/PaintEventDispatcher.java
> src/java.desktop/share/classes/sun/font/SunFontManager.java
> Some are just references in comments as is the case in the last file
> 
> 
> 2 tests are removed as a result
> jdk/javax/swing/system/6799345/TestShutdown.java - NPE because main 
> appcontext not created.
> jdk/sun/awt/AppContext/8012933/Test8012933.java - calls AppContext.dispose() 
> which interrupts the EDT
> 
> Regarding the latter, see my comment in EventDispatchThread.java

src/java.desktop/share/classes/java/awt/EventDispatchThread.java line 205:

> 203:             eq.dispatchEvent(event);
> 204:         }
> 205:         catch (InterruptedException interruptedException) {

I initially removed this whole block which means that if Thread.interrupt() is 
called on this the exception will propagate.
A test (jdk/sun/awt/AppContext/8012933/Test8012933.java) calls 
AppContext.dispose() which causes that to happen. I deleted the test because it 
is obsolete, but I decided to restore the catch block in case some other 
unknown scenario would do the same interrupt.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30463#discussion_r2997639622

Reply via email to