RFR: 8378297: Remove AppContext from several Swing component and related classes [v3]

Phil Race prr at openjdk.org
Wed Feb 25 18:01:48 UTC 2026


On Wed, 25 Feb 2026 17:02:56 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8378297
>
> src/java.desktop/share/classes/javax/swing/DebugGraphics.java line 1495:
> 
>> 1493:       */
>> 1494:     static DebugGraphicsInfo info() {
>> 1495:         synchronized (DebugGraphicsInfo.class) {
> 
> I suppose the DCL pattern could be used here to avoid the `synchronized` block on subsequent calls.
> 
> Same applies to other files, like `PopupFactory`, `SwingUtilities`, `ToolTipManager`

I figured we are no worse off with this since as was pointed out in some other PR AppContext.get() (and put) synchronizes.
And none of these seem likely to be contended locks or performance critical.

> src/java.desktop/share/classes/javax/swing/JPopupMenu.java line 156:
> 
>> 154:     private static final boolean DEBUG =   false;  // show bad params, misc.
>> 155: 
>> 156:     private static boolean defaultLWPopupEnabled = true;
> 
> It looks like you forgot to remove `defaultLWPopupEnabledKey`

oops. removing it now.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29830#discussion_r2854528840
PR Review Comment: https://git.openjdk.org/jdk/pull/29830#discussion_r2854507784


More information about the client-libs-dev mailing list