On Fri, 22 May 2026 22:11:41 GMT, Phil Race <[email protected]> wrote:

>> This removes the remaining uses of AppContext and AppContext itself.
>> 
>> Some tests needed to be removed. Some seemed possibly still useful if I 
>> removed AppContext.
>> 
>> The source code changes are fairly straightforward  - almost entirely just 
>> deletions.
>> 
>> The only interesting question is where to call SunToolkit.initEQ()
>> It was usually initialized via the AppContext creation which isn't possible 
>> any more.
>> 
>> The EQ can - in theory - be created lazily.
>> But because the EQ needs to be created before any events are posted there 
>> aren't many places to choose from.
>> I've put it in the SunToolkit constructor, and it is also - of course - 
>> still initialized in the static method to get the EQ.
>> In postEvent() itself was the only other option that worked but then it is 
>> checked *every* time an event is posted.
>> One of the 2 above seems to be always needed to cover all paths.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Phil Race has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   8385347

There are a few more mentions of the AppContext


./src/java.logging/share/classes/java/util/logging/LogManager.java:424:    // 
Returns the LoggerContext for the user code (i.e. application or AppContext).
./src/java.logging/share/classes/java/util/logging/LogManager.java:425:    // 
Loggers are isolated from each AppContext.
./src/jdk.unsupported.desktop/share/classes/jdk/swing/interop/SwingInterOpUtils.java:36:
 * to access and use jdk internal classes like SunToolkit, AppContext
./test/jdk/java/util/logging/TestLoggingWithMainAppContext.java:36: * @run 
main/othervm TestLoggingWithMainAppContext
./test/jdk/java/util/logging/TestLoggingWithMainAppContext.java:38:public class 
TestLoggingWithMainAppContext {
./test/jdk/java/util/logging/TestLoggingWithMainAppContext.java:51:        // 
Triggers the creation of the main AppContext
./test/jdk/java/util/logging/TestLoggingWithMainAppContext.java:53:        
ImageIO.read(is); // triggers calls to system loggers & creation of main 
AppContext
./test/jdk/ProblemList.txt:145:java/awt/Focus/ActivateOnProperAppContextTest.java
 8136516 macosx-all

test/jdk/java/awt/Dialog/JaWSTest.java line 125:

> 123:         System.err.println("Running");
> 124:         try {
> 125:        } finally {

The empty try-finally block seems unnecessary.

test/jdk/java/awt/Focus/ActivateOnProperAppContextTest.java line 1:

> 1: /*

The test is still present in the `ProblemList.txt`

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

PR Review: https://git.openjdk.org/jdk/pull/31262#pullrequestreview-4367087495
PR Review Comment: https://git.openjdk.org/jdk/pull/31262#discussion_r3306579544
PR Review Comment: https://git.openjdk.org/jdk/pull/31262#discussion_r3306529050

Reply via email to