From 2b8c5e6039971e2ca6c2af24b64676db4348971b Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 21 May 2026 17:32:07 +0000 Subject: [PATCH] 8384808: Remove AppContext-based Window Activation time map from SunToolkit Reviewed-by: azvegint, kizune --- .../share/classes/sun/awt/SunToolkit.java | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/java.desktop/share/classes/sun/awt/SunToolkit.java b/src/java.desktop/share/classes/sun/awt/SunToolkit.java index 238ca32bd29..23ec5f54959 100644 --- a/src/java.desktop/share/classes/sun/awt/SunToolkit.java +++ b/src/java.desktop/share/classes/sun/awt/SunToolkit.java @@ -1787,34 +1787,20 @@ public abstract class SunToolkit extends Toolkit public void dismissPopupOnFocusLostIfNeededCleanUp(Window invoker) {} - - private static final Object DEACTIVATION_TIMES_MAP_KEY = new Object(); + private static WeakHashMap activationMap = null; public synchronized void setWindowDeactivationTime(Window w, long time) { - AppContext ctx = getAppContext(w); - if (ctx == null) { - return; + if (activationMap == null) { + activationMap = new WeakHashMap(); } - @SuppressWarnings("unchecked") - WeakHashMap map = (WeakHashMap)ctx.get(DEACTIVATION_TIMES_MAP_KEY); - if (map == null) { - map = new WeakHashMap(); - ctx.put(DEACTIVATION_TIMES_MAP_KEY, map); - } - map.put(w, time); + activationMap.put(w, time); } public synchronized long getWindowDeactivationTime(Window w) { - AppContext ctx = getAppContext(w); - if (ctx == null) { + if (activationMap == null) { return -1; } - @SuppressWarnings("unchecked") - WeakHashMap map = (WeakHashMap)ctx.get(DEACTIVATION_TIMES_MAP_KEY); - if (map == null) { - return -1; - } - Long time = map.get(w); + Long time = activationMap.get(w); return time == null ? -1 : time; }