RFR: 8344059: Remove doPrivileged calls from windows platform sources in the java.desktop module [v4]

Kevin Rushforth kcr at openjdk.org
Fri Nov 15 12:45:58 UTC 2024


On Fri, 15 Nov 2024 03:29:13 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Since JEP 486 : Permanently Disable the Security Manager
>> [https://bugs.openjdk.org/browse/JDK-8338625] is now integrated, calls to java.security.AccessController.doPrivileged are obsolete and can be removed. 
>> 
>> This PR takes care of the windows-platform files in the java.desktop module to have them removed.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review comment

The code changes look good. I noted a few unused imports and unneeded `@SuppressWarnings("removal")` annotations that you can cleanup.

src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java line 186:

> 184:         // to be switched off either at runtime or programmatically
> 185:         //
> 186:         String systemFonts = System.getProperty("swing.useSystemFontSettings");

This file has a now-unused import of `GetPropertyAction`.

src/java.desktop/windows/classes/sun/awt/Win32FontManager.java line 264:

> 262:         java.security.AccessController.doPrivileged(
> 263:             new java.security.PrivilegedAction<Object>() {
> 264:                 public Object run() {

Is the `@SuppressWarnings("removal")` on this method still needed?

src/java.desktop/windows/classes/sun/awt/windows/TranslucentWindowPainter.java line 69:

> 67:     // REMIND: we probably would want to remove this later
> 68:     private static final boolean forceOpt  =
> 69:         Boolean.getBoolean(System.getProperty("sun.java2d.twp.forceopt", "false"));

This file has a now-unused import of `GetPropertyAction`.

src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java line 62:

> 60: 
> 61:     @SuppressWarnings("removal")
> 62:     private static String printScale = System.getProperty("sun.java2d.print.pluginscalefactor");

You can get rid of the `@SuppressWarnings("removal")` here.

Also, this file has a now-unused import of `GetPropertyAction`.

src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java line 189:

> 187:             // if no system property is specified,
> 188:             // check for environment setting
> 189:             printScale = System.getenv("JAVA2D_PLUGIN_PRINT_SCALE");

Is the `@SuppressWarnings("removal")` on this method still needed?

src/java.desktop/windows/classes/sun/awt/windows/WFramePeer.java line 83:

> 81: 
> 82:     private static final boolean keepOnMinimize = "true".equals(
> 83:             System.getProperty("sun.awt.keepWorkingSetOnMinimize"));

This file has a now-unused import of `GetPropertyAction`.

src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java line 220:

> 218: 
> 219:         // Find a root TG and attach toolkit thread to it
> 220:         ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();

Is the `@SuppressWarnings("removal")` on this constructor still needed?

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

PR Review: https://git.openjdk.org/jdk/pull/22083#pullrequestreview-2438457458
PR Review Comment: https://git.openjdk.org/jdk/pull/22083#discussion_r1843694253
PR Review Comment: https://git.openjdk.org/jdk/pull/22083#discussion_r1843699113
PR Review Comment: https://git.openjdk.org/jdk/pull/22083#discussion_r1843695193
PR Review Comment: https://git.openjdk.org/jdk/pull/22083#discussion_r1843695616
PR Review Comment: https://git.openjdk.org/jdk/pull/22083#discussion_r1843702924
PR Review Comment: https://git.openjdk.org/jdk/pull/22083#discussion_r1843696519
PR Review Comment: https://git.openjdk.org/jdk/pull/22083#discussion_r1843704522


More information about the client-libs-dev mailing list