diff --git a/src/java.desktop/share/classes/javax/swing/AbstractAction.java b/src/java.desktop/share/classes/javax/swing/AbstractAction.java
index 6a22a985d69..2bf40e810c6 100644
--- a/src/java.desktop/share/classes/javax/swing/AbstractAction.java
+++ b/src/java.desktop/share/classes/javax/swing/AbstractAction.java
@@ -32,12 +32,9 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serial;
import java.io.Serializable;
-import java.security.AccessController;
import javax.swing.event.SwingPropertyChangeSupport;
-import sun.security.action.GetPropertyAction;
-
/**
* This class provides default implementations for the JFC Action
* interface. Standard behaviors like the get and set methods for
@@ -81,14 +78,11 @@ public abstract class AbstractAction implements Action, Cloneable, Serializable
* Whether or not to reconfigure all action properties from the
* specified event.
*/
- @SuppressWarnings("removal")
static boolean shouldReconfigure(PropertyChangeEvent e) {
if (e.getPropertyName() == null) {
synchronized(AbstractAction.class) {
if (RECONFIGURE_ON_NULL == null) {
- RECONFIGURE_ON_NULL = Boolean.valueOf(
- AccessController.doPrivileged(new GetPropertyAction(
- "swing.actions.reconfigureOnNull", "false")));
+ RECONFIGURE_ON_NULL = Boolean.getBoolean("swing.actions.reconfigureOnNull");
}
return RECONFIGURE_ON_NULL;
}
diff --git a/src/java.desktop/share/classes/javax/swing/DebugGraphics.java b/src/java.desktop/share/classes/javax/swing/DebugGraphics.java
index 9a9a4fbe70f..1d6c52c4680 100644
--- a/src/java.desktop/share/classes/javax/swing/DebugGraphics.java
+++ b/src/java.desktop/share/classes/javax/swing/DebugGraphics.java
@@ -27,8 +27,6 @@ package javax.swing;
import java.awt.*;
import java.awt.image.*;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.text.AttributedCharacterIterator;
/**
@@ -79,7 +77,6 @@ public class DebugGraphics extends Graphics {
* applications, it is for internal use only. When called directly
* it will create an un-usable instance.
*/
- @SuppressWarnings("removal")
public DebugGraphics() {
super();
buffer = null;
@@ -87,14 +84,7 @@ public class DebugGraphics extends Graphics {
// Creates a Graphics context when the constructor is called.
if (this.graphics == null) {
- StackWalker walker = AccessController.doPrivileged(new PrivilegedAction() {
- @Override
- public StackWalker run() {
- StackWalker stackwalker = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
- return stackwalker;
- }
- });
-
+ StackWalker walker = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
if (walker.getCallerClass() != this.getClass()) {
BufferedImage bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
this.graphics = bi.createGraphics();
diff --git a/src/java.desktop/share/classes/javax/swing/ImageIcon.java b/src/java.desktop/share/classes/javax/swing/ImageIcon.java
index 2eeac8961bc..2bae31ba31f 100644
--- a/src/java.desktop/share/classes/javax/swing/ImageIcon.java
+++ b/src/java.desktop/share/classes/javax/swing/ImageIcon.java
@@ -44,10 +44,6 @@ import java.io.ObjectOutputStream;
import java.io.Serial;
import java.io.Serializable;
import java.net.URL;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.ProtectionDomain;
import java.util.Locale;
import javax.accessibility.Accessible;
@@ -105,27 +101,19 @@ public class ImageIcon implements Icon, Serializable, Accessible {
* It is left for backward compatibility only.
* @deprecated since 1.8
*/
- @SuppressWarnings("removal")
@Deprecated
- protected static final Component component
- = AccessController.doPrivileged(new PrivilegedAction() {
- public Component run() {
- try {
- final Component component = createNoPermsComponent();
+ protected static final Component component = createComponent();
- // 6482575 - clear the appContext field so as not to leak it
- AWTAccessor.getComponentAccessor().
- setAppContext(component, null);
-
- return component;
- } catch (Throwable e) {
- // We don't care about component.
- // So don't prevent class initialisation.
- e.printStackTrace();
- return null;
- }
+ private static final Component createComponent() {
+ try {
+ Component component = new Component() {};
+ // 6482575 - clear the appContext field so as not to leak it
+ AWTAccessor.getComponentAccessor().setAppContext(component, null);
+ return component;
+ } catch (Throwable t) {
+ return null;
}
- });
+ }
/**
* Do not use this shared media tracker, which is used to load images.
@@ -135,23 +123,6 @@ public class ImageIcon implements Icon, Serializable, Accessible {
@Deprecated
protected static final MediaTracker tracker = new MediaTracker(component);
- @SuppressWarnings("removal")
- private static Component createNoPermsComponent() {
- // 7020198 - set acc field to no permissions and no subject
- // Note, will have appContext set.
- return AccessController.doPrivileged(
- new PrivilegedAction() {
- public Component run() {
- return new Component() {
- };
- }
- },
- new AccessControlContext(new ProtectionDomain[]{
- new ProtectionDomain(null, null)
- })
- );
- }
-
/**
* Id used in loading images from MediaTracker.
*/
diff --git a/src/java.desktop/share/classes/javax/swing/JLayer.java b/src/java.desktop/share/classes/javax/swing/JLayer.java
index c2076299e44..b08b140933f 100644
--- a/src/java.desktop/share/classes/javax/swing/JLayer.java
+++ b/src/java.desktop/share/classes/javax/swing/JLayer.java
@@ -38,8 +38,6 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serial;
import java.util.ArrayList;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
/**
* {@code JLayer} is a universal decorator for Swing components
@@ -816,27 +814,14 @@ public final class JLayer
return currentEventMask;
}
- @SuppressWarnings("removal")
private void addAWTEventListener(final long eventMask) {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Void run() {
- Toolkit.getDefaultToolkit().
- addAWTEventListener(LayerEventController.this, eventMask);
- return null;
- }
- });
-
+ Toolkit.getDefaultToolkit().
+ addAWTEventListener(LayerEventController.this, eventMask);
}
- @SuppressWarnings("removal")
private void removeAWTEventListener() {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Void run() {
- Toolkit.getDefaultToolkit().
- removeAWTEventListener(LayerEventController.this);
- return null;
- }
- });
+ Toolkit.getDefaultToolkit().
+ removeAWTEventListener(LayerEventController.this);
}
private boolean isEventEnabled(long eventMask, int id) {
diff --git a/src/java.desktop/share/classes/javax/swing/JPopupMenu.java b/src/java.desktop/share/classes/javax/swing/JPopupMenu.java
index 29cc59b1bb1..d1fff6a11e0 100644
--- a/src/java.desktop/share/classes/javax/swing/JPopupMenu.java
+++ b/src/java.desktop/share/classes/javax/swing/JPopupMenu.java
@@ -119,11 +119,8 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
new StringBuffer("JPopupMenu.defaultLWPopupEnabledKey");
/** Bug#4425878-Property javax.swing.adjustPopupLocationToFit introduced */
- @SuppressWarnings("removal")
static boolean popupPositionFixDisabled =
- java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction(
- "javax.swing.adjustPopupLocationToFit","")).equals("false");
+ System.getProperty("javax.swing.adjustPopupLocationToFit","").equals("false");
transient Component invoker;
transient Popup popup;
diff --git a/src/java.desktop/share/classes/javax/swing/JRootPane.java b/src/java.desktop/share/classes/javax/swing/JRootPane.java
index 0e2668b363a..44eb41248e6 100644
--- a/src/java.desktop/share/classes/javax/swing/JRootPane.java
+++ b/src/java.desktop/share/classes/javax/swing/JRootPane.java
@@ -26,13 +26,10 @@ package javax.swing;
import java.awt.*;
import java.beans.*;
-import java.security.AccessController;
import javax.accessibility.*;
import javax.swing.plaf.RootPaneUI;
import java.io.Serializable;
-import sun.security.action.GetBooleanAction;
-
/**
* A lightweight container used behind the scenes by
@@ -202,19 +199,15 @@ public class JRootPane extends JComponent implements Accessible {
* Whether or not we should dump the stack when true double buffering
* is disabled. Default is false.
*/
- @SuppressWarnings("removal")
private static final boolean LOG_DISABLE_TRUE_DOUBLE_BUFFERING
- = AccessController.doPrivileged(new GetBooleanAction(
- "swing.logDoubleBufferingDisable"));
+ = Boolean.getBoolean("swing.logDoubleBufferingDisable");
/**
* Whether or not we should ignore requests to disable true double
* buffering. Default is false.
*/
- @SuppressWarnings("removal")
private static final boolean IGNORE_DISABLE_TRUE_DOUBLE_BUFFERING
- = AccessController.doPrivileged(new GetBooleanAction(
- "swing.ignoreDoubleBufferingDisable"));
+ = Boolean.getBoolean("swing.ignoreDoubleBufferingDisable");
/**
* Constant used for the windowDecorationStyle property. Indicates that
diff --git a/src/java.desktop/share/classes/javax/swing/RepaintManager.java b/src/java.desktop/share/classes/javax/swing/RepaintManager.java
index eb696a7b489..2636c81be07 100644
--- a/src/java.desktop/share/classes/javax/swing/RepaintManager.java
+++ b/src/java.desktop/share/classes/javax/swing/RepaintManager.java
@@ -28,9 +28,6 @@ package javax.swing;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.VolatileImage;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.applet.*;
@@ -211,22 +208,13 @@ public class RepaintManager
}
});
- @SuppressWarnings("removal")
- var t1 = "true".equals(AccessController.
- doPrivileged(new GetPropertyAction(
- "swing.volatileImageBufferEnabled", "true")));
- volatileImageBufferEnabled = t1;
+ volatileImageBufferEnabled = "true".equals(System.getProperty("swing.volatileImageBufferEnabled", "true"));
boolean headless = GraphicsEnvironment.isHeadless();
if (volatileImageBufferEnabled && headless) {
volatileImageBufferEnabled = false;
}
- @SuppressWarnings("removal")
- var t2 = "true".equals(AccessController.doPrivileged(
- new GetPropertyAction("awt.nativeDoubleBuffering")));
- nativeDoubleBuffering = t2;
- @SuppressWarnings("removal")
- String bs = AccessController.doPrivileged(
- new GetPropertyAction("swing.bufferPerWindow"));
+ nativeDoubleBuffering = "true".equals(System.getProperty("awt.nativeDoubleBuffering"));
+ String bs = System.getProperty("swing.bufferPerWindow");
if (headless) {
BUFFER_STRATEGY_TYPE = BUFFER_STRATEGY_SPECIFIED_OFF;
}
@@ -239,10 +227,7 @@ public class RepaintManager
else {
BUFFER_STRATEGY_TYPE = BUFFER_STRATEGY_SPECIFIED_OFF;
}
- @SuppressWarnings("removal")
- var t3 = "true".equals(AccessController.doPrivileged(
- new GetPropertyAction("swing.handleTopLevelPaint", "true")));
- HANDLE_TOP_LEVEL_PAINT = t3;
+ HANDLE_TOP_LEVEL_PAINT = "true".equals(System.getProperty("swing.handleTopLevelPaint", "true"));
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
if (ge instanceof SunGraphicsEnvironment) {
@@ -611,21 +596,7 @@ public class RepaintManager
if (runnableList == null) {
runnableList = new LinkedList();
}
- runnableList.add(new Runnable() {
- public void run() {
- @SuppressWarnings("removal")
- AccessControlContext stack = AccessController.getContext();
- @SuppressWarnings("removal")
- AccessControlContext acc =
- AWTAccessor.getComponentAccessor().getAccessControlContext(c);
- javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction() {
- public Void run() {
- r.run();
- return null;
- }
- }, stack, acc);
- }
- });
+ runnableList.add(r);
}
scheduleProcessingRunnable(appContext);
}
@@ -746,18 +717,7 @@ public class RepaintManager
int n = ic.size();
for(int i = 0; i < n; i++) {
final Component c = ic.get(i);
- @SuppressWarnings("removal")
- AccessControlContext stack = AccessController.getContext();
- @SuppressWarnings("removal")
- AccessControlContext acc =
- AWTAccessor.getComponentAccessor().getAccessControlContext(c);
- javaSecurityAccess.doIntersectionPrivilege(
- new PrivilegedAction() {
- public Void run() {
- c.validate();
- return null;
- }
- }, stack, acc);
+ c.validate();
}
}
@@ -853,61 +813,50 @@ public class RepaintManager
for (int j=0 ; j < count.get(); j++) {
final int i = j;
final Component dirtyComponent = roots.get(j);
- @SuppressWarnings("removal")
- AccessControlContext stack = AccessController.getContext();
- @SuppressWarnings("removal")
- AccessControlContext acc =
- AWTAccessor.getComponentAccessor().getAccessControlContext(dirtyComponent);
- javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction() {
- public Void run() {
- Rectangle rect = tmpDirtyComponents.get(dirtyComponent);
- // Sometimes when RepaintManager is changed during the painting
- // we may get null here, see #6995769 for details
- if (rect == null) {
- return null;
- }
+ Rectangle rect = tmpDirtyComponents.get(dirtyComponent);
+ // Sometimes when RepaintManager is changed during the painting
+ // we may get null here, see #6995769 for details
+ if (rect == null) {
+ continue;
+ }
- int localBoundsH = dirtyComponent.getHeight();
- int localBoundsW = dirtyComponent.getWidth();
- SwingUtilities.computeIntersection(0,
- 0,
- localBoundsW,
- localBoundsH,
- rect);
- if (dirtyComponent instanceof JComponent) {
- ((JComponent)dirtyComponent).paintImmediately(
- rect.x,rect.y,rect.width, rect.height);
+ int localBoundsH = dirtyComponent.getHeight();
+ int localBoundsW = dirtyComponent.getWidth();
+ SwingUtilities.computeIntersection(0,
+ 0,
+ localBoundsW,
+ localBoundsH,
+ rect);
+ if (dirtyComponent instanceof JComponent) {
+ ((JComponent)dirtyComponent).paintImmediately(
+ rect.x,rect.y,rect.width, rect.height);
+ }
+ else if (dirtyComponent.isShowing()) {
+ Graphics g = JComponent.safelyGetGraphics(
+ dirtyComponent, dirtyComponent);
+ // If the Graphics goes away, it means someone disposed of
+ // the window, don't do anything.
+ if (g != null) {
+ g.setClip(rect.x, rect.y, rect.width, rect.height);
+ try {
+ dirtyComponent.paint(g);
+ } finally {
+ g.dispose();
}
- else if (dirtyComponent.isShowing()) {
- Graphics g = JComponent.safelyGetGraphics(
- dirtyComponent, dirtyComponent);
- // If the Graphics goes away, it means someone disposed of
- // the window, don't do anything.
- if (g != null) {
- g.setClip(rect.x, rect.y, rect.width, rect.height);
- try {
- dirtyComponent.paint(g);
- } finally {
- g.dispose();
- }
- }
- }
- // If the repaintRoot has been set, service it now and
- // remove any components that are children of repaintRoot.
- if (repaintRoot != null) {
- adjustRoots(repaintRoot, roots, i + 1);
- count.set(roots.size());
- paintManager.isRepaintingRoot = true;
- repaintRoot.paintImmediately(0, 0, repaintRoot.getWidth(),
- repaintRoot.getHeight());
- paintManager.isRepaintingRoot = false;
- // Only service repaintRoot once.
- repaintRoot = null;
- }
-
- return null;
}
- }, stack, acc);
+ }
+ // If the repaintRoot has been set, service it now and
+ // remove any components that are children of repaintRoot.
+ if (repaintRoot != null) {
+ adjustRoots(repaintRoot, roots, i + 1);
+ count.set(roots.size());
+ paintManager.isRepaintingRoot = true;
+ repaintRoot.paintImmediately(0, 0, repaintRoot.getWidth(),
+ repaintRoot.getHeight());
+ paintManager.isRepaintingRoot = false;
+ // Only service repaintRoot once.
+ repaintRoot = null;
+ }
}
} finally {
painting = false;
diff --git a/src/java.desktop/share/classes/javax/swing/SortingFocusTraversalPolicy.java b/src/java.desktop/share/classes/javax/swing/SortingFocusTraversalPolicy.java
index 92f98fdfc99..ab306187e32 100644
--- a/src/java.desktop/share/classes/javax/swing/SortingFocusTraversalPolicy.java
+++ b/src/java.desktop/share/classes/javax/swing/SortingFocusTraversalPolicy.java
@@ -29,8 +29,6 @@ import java.awt.Container;
import java.util.*;
import java.awt.FocusTraversalPolicy;
import sun.util.logging.PlatformLogger;
-import sun.security.action.GetPropertyAction;
-import java.security.AccessController;
/**
* A FocusTraversalPolicy that determines traversal order by sorting the
@@ -95,10 +93,8 @@ public class SortingFocusTraversalPolicy
* When false, the default (tim-sort) algo is used, which may lead to an exception.
* See: JDK-8048887
*/
- @SuppressWarnings("removal")
private static final boolean legacySortingFTPEnabled = "true".equals(
- AccessController.doPrivileged(
- new GetPropertyAction("swing.legacySortingFTPEnabled", "true")));
+ System.getProperty("swing.legacySortingFTPEnabled", "true"));
/**
* Constructs a SortingFocusTraversalPolicy without a Comparator.
diff --git a/src/java.desktop/share/classes/javax/swing/SwingPaintEventDispatcher.java b/src/java.desktop/share/classes/javax/swing/SwingPaintEventDispatcher.java
index d0e34256ed4..4bada6e8bc7 100644
--- a/src/java.desktop/share/classes/javax/swing/SwingPaintEventDispatcher.java
+++ b/src/java.desktop/share/classes/javax/swing/SwingPaintEventDispatcher.java
@@ -32,8 +32,6 @@ import java.security.AccessController;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
import sun.awt.event.IgnorePaintEvent;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetPropertyAction;
/**
* Swing's PaintEventDispatcher. If the component specified by the PaintEvent
@@ -41,16 +39,15 @@ import sun.security.action.GetPropertyAction;
* will forward the request to the RepaintManager for eventual painting.
*
*/
-@SuppressWarnings("removal")
class SwingPaintEventDispatcher extends sun.awt.PaintEventDispatcher {
private static final boolean SHOW_FROM_DOUBLE_BUFFER;
private static final boolean ERASE_BACKGROUND;
static {
- SHOW_FROM_DOUBLE_BUFFER = "true".equals(AccessController.doPrivileged(
- new GetPropertyAction("swing.showFromDoubleBuffer", "true")));
- ERASE_BACKGROUND = AccessController.doPrivileged(
- new GetBooleanAction("swing.nativeErase"));
+ SHOW_FROM_DOUBLE_BUFFER =
+ "true".equals(System.getProperty("swing.showFromDoubleBuffer", "true"));
+ ERASE_BACKGROUND =
+ "true".equals(System.getProperty("swing.swing.nativeErase", "false"));
}
public PaintEvent createPaintEvent(Component component, int x, int y,
diff --git a/src/java.desktop/share/classes/javax/swing/SwingUtilities.java b/src/java.desktop/share/classes/javax/swing/SwingUtilities.java
index 40970622956..89fe8970531 100644
--- a/src/java.desktop/share/classes/javax/swing/SwingUtilities.java
+++ b/src/java.desktop/share/classes/javax/swing/SwingUtilities.java
@@ -40,8 +40,6 @@ import javax.accessibility.*;
import javax.swing.event.MenuDragMouseEvent;
import javax.swing.plaf.UIResource;
import javax.swing.text.View;
-import java.security.AccessController;
-import sun.security.action.GetPropertyAction;
import sun.awt.AppContext;
import sun.awt.AWTAccessor;
@@ -75,12 +73,9 @@ public class SwingUtilities implements SwingConstants
* Returns true if setTransferHandler
should change the
* DropTarget
.
*/
- @SuppressWarnings("removal")
private static boolean getSuppressDropTarget() {
if (!checkedSuppressDropSupport) {
- suppressDropSupport = Boolean.parseBoolean(
- AccessController.doPrivileged(
- new GetPropertyAction("suppressSwingDropSupport")));
+ suppressDropSupport = Boolean.getBoolean("suppressSwingDropSupport");
checkedSuppressDropSupport = true;
}
return suppressDropSupport;
diff --git a/src/java.desktop/share/classes/javax/swing/SwingWorker.java b/src/java.desktop/share/classes/javax/swing/SwingWorker.java
index 4eacdfcbf50..a8f1e754aab 100644
--- a/src/java.desktop/share/classes/javax/swing/SwingWorker.java
+++ b/src/java.desktop/share/classes/javax/swing/SwingWorker.java
@@ -31,8 +31,6 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.lang.ref.WeakReference;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
@@ -797,7 +795,6 @@ public abstract class SwingWorker implements RunnableFuture {
final ExecutorService es = executorService;
appContext.addPropertyChangeListener(AppContext.DISPOSED_PROPERTY_NAME,
new PropertyChangeListener() {
- @SuppressWarnings("removal")
@Override
public void propertyChange(PropertyChangeEvent pce) {
boolean disposed = (Boolean)pce.getNewValue();
@@ -807,14 +804,7 @@ public abstract class SwingWorker implements RunnableFuture {
final ExecutorService executorService =
executorServiceRef.get();
if (executorService != null) {
- AccessController.doPrivileged(
- new PrivilegedAction() {
- public Void run() {
- executorService.shutdown();
- return null;
- }
- }
- );
+ executorService.shutdown();
}
}
}
diff --git a/src/java.desktop/share/classes/javax/swing/Timer.java b/src/java.desktop/share/classes/javax/swing/Timer.java
index 4974aee0b7c..3801eb0a072 100644
--- a/src/java.desktop/share/classes/javax/swing/Timer.java
+++ b/src/java.desktop/share/classes/javax/swing/Timer.java
@@ -32,9 +32,6 @@ import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.Serial;
import java.io.Serializable;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.EventListener;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
@@ -209,25 +206,6 @@ public class Timer implements Serializable
}
}
- /*
- * The timer's AccessControlContext.
- */
- @SuppressWarnings("removal")
- private transient volatile AccessControlContext acc =
- AccessController.getContext();
-
- /**
- * Returns the acc this timer was constructed with.
- */
- @SuppressWarnings("removal")
- final AccessControlContext getAccessControlContext() {
- if (acc == null) {
- throw new SecurityException(
- "Timer is missing AccessControlContext");
- }
- return acc;
- }
-
/**
* DoPostEvent is a runnable class that fires actionEvents to
* the listeners on the EventDispatchThread, via invokeLater.
@@ -609,15 +587,9 @@ public class Timer implements Serializable
}
- @SuppressWarnings("removal")
void post() {
- if (notify.compareAndSet(false, true) || !coalesce) {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Void run() {
- SwingUtilities.invokeLater(doPostEvent);
- return null;
- }
- }, getAccessControlContext());
+ if (notify.compareAndSet(false, true) || !coalesce) {
+ SwingUtilities.invokeLater(doPostEvent);
}
}
@@ -630,7 +602,6 @@ public class Timer implements Serializable
private void readObject(ObjectInputStream in)
throws ClassNotFoundException, IOException
{
- this.acc = AccessController.getContext();
ObjectInputStream.GetField f = in.readFields();
EventListenerList newListenerList = (EventListenerList)
diff --git a/src/java.desktop/share/classes/javax/swing/TimerQueue.java b/src/java.desktop/share/classes/javax/swing/TimerQueue.java
index 2743baefae6..249593caa7e 100644
--- a/src/java.desktop/share/classes/javax/swing/TimerQueue.java
+++ b/src/java.desktop/share/classes/javax/swing/TimerQueue.java
@@ -25,8 +25,6 @@
package javax.swing;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.concurrent.*;
import java.util.concurrent.locks.*;
import java.util.concurrent.atomic.AtomicLong;
@@ -83,7 +81,6 @@ class TimerQueue implements Runnable
}
- @SuppressWarnings("removal")
void startIfNeeded() {
if (! running) {
runningLock.lock();
@@ -92,15 +89,11 @@ class TimerQueue implements Runnable
}
try {
final ThreadGroup threadGroup = AppContext.getAppContext().getThreadGroup();
- AccessController.doPrivileged((PrivilegedAction