From 7709d435d080778a45bd3eb9a5754e356e94e6de Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 21 Nov 2024 20:29:53 +0000 Subject: [PATCH] 8344782: Cleanup left over doPrivileged calls and imports in java.desktop Reviewed-by: honkar --- .../macosx/classes/com/apple/laf/AquaLookAndFeel.java | 1 - src/java.desktop/share/classes/java/awt/Cursor.java | 1 - .../javax/swing/text/html/parser/ParserDelegator.java | 3 --- .../share/classes/sun/awt/im/InputMethodManager.java | 4 ---- .../share/classes/sun/font/FontManagerNativeLibrary.java | 1 - .../share/classes/sun/swing/WindowsPlacesBar.java | 2 -- .../unix/classes/sun/awt/X11/XWindowPeer.java | 9 +-------- 7 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java b/src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java index 34a39525a74..07637d5454c 100644 --- a/src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java +++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java @@ -28,7 +28,6 @@ package com.apple.laf; import java.awt.Color; import java.awt.Dimension; import java.awt.KeyboardFocusManager; -import java.security.PrivilegedAction; import java.util.Enumeration; import java.util.Locale; import java.util.ResourceBundle; diff --git a/src/java.desktop/share/classes/java/awt/Cursor.java b/src/java.desktop/share/classes/java/awt/Cursor.java index 8a595f61285..396165e7ec8 100644 --- a/src/java.desktop/share/classes/java/awt/Cursor.java +++ b/src/java.desktop/share/classes/java/awt/Cursor.java @@ -28,7 +28,6 @@ package java.awt; import java.beans.ConstructorProperties; import java.io.InputStream; import java.io.Serial; -import java.security.AccessController; import java.util.Hashtable; import java.util.Properties; import java.util.StringTokenizer; diff --git a/src/java.desktop/share/classes/javax/swing/text/html/parser/ParserDelegator.java b/src/java.desktop/share/classes/javax/swing/text/html/parser/ParserDelegator.java index bf360574f6d..0f89e49a171 100644 --- a/src/java.desktop/share/classes/javax/swing/text/html/parser/ParserDelegator.java +++ b/src/java.desktop/share/classes/javax/swing/text/html/parser/ParserDelegator.java @@ -121,9 +121,6 @@ public class ParserDelegator extends HTMLEditorKit.Parser implements Serializabl /** * Fetch a resource relative to the ParserDelegator classfile. - * If this is called on 1.2 the loading will occur under the - * protection of a doPrivileged call to allow the ParserDelegator - * to function when used in an applet. * * @param name the name of the resource, relative to the * ParserDelegator class. diff --git a/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java b/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java index f61825d8ddf..3484f7cbebe 100644 --- a/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java +++ b/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java @@ -41,10 +41,6 @@ import java.awt.event.ActionListener; import java.awt.event.InvocationEvent; import java.awt.im.spi.InputMethodDescriptor; import java.lang.reflect.InvocationTargetException; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; import java.util.Hashtable; import java.util.Iterator; import java.util.Locale; diff --git a/src/java.desktop/share/classes/sun/font/FontManagerNativeLibrary.java b/src/java.desktop/share/classes/sun/font/FontManagerNativeLibrary.java index 51997571e75..e3baf437a8b 100644 --- a/src/java.desktop/share/classes/sun/font/FontManagerNativeLibrary.java +++ b/src/java.desktop/share/classes/sun/font/FontManagerNativeLibrary.java @@ -61,7 +61,6 @@ public class FontManagerNativeLibrary { * Method acts as trigger to ensure this class is loaded * (and therefore initializer code is executed). * Actual loading is performed by static initializer. - * (no need to execute doPrivileged block more than once) */ public static void load() {} } diff --git a/src/java.desktop/share/classes/sun/swing/WindowsPlacesBar.java b/src/java.desktop/share/classes/sun/swing/WindowsPlacesBar.java index 8cc47c306c4..cd54d40bd0a 100644 --- a/src/java.desktop/share/classes/sun/swing/WindowsPlacesBar.java +++ b/src/java.desktop/share/classes/sun/swing/WindowsPlacesBar.java @@ -36,8 +36,6 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; -import java.security.AccessController; -import java.security.PrivilegedAction; import javax.swing.JToolBar; import javax.swing.JFileChooser; diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java index 267ad9349ea..ebd04f2b7dd 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java @@ -47,8 +47,6 @@ import java.awt.event.FocusEvent; import java.awt.event.WindowEvent; import java.awt.peer.ComponentPeer; import java.awt.peer.WindowPeer; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; @@ -1322,12 +1320,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, return; } - @SuppressWarnings("removal") - final String desktopStartupId = AccessController.doPrivileged(new PrivilegedAction() { - public String run() { - return XToolkit.getEnv("DESKTOP_STARTUP_ID"); - } - }); + final String desktopStartupId = XToolkit.getEnv("DESKTOP_STARTUP_ID"); if (desktopStartupId == null) { return; }