RFR: JDK-8344058 : Remove doPrivileged calls from macos platform sources in the java.desktop module

Harshitha Onkar honkar at openjdk.org
Fri Nov 15 19:23:03 UTC 2024


On Fri, 15 Nov 2024 18:45:11 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

> Post JEP-486 (Permanently Disable the Security Manager) cleanup. 
> Calls to java.security.AccessController.doPrivileged are obsolete thus removed in this PR.
> 
> This PR addresses removal of AccessController.doPrivileged() calls from macos-platform files in the java.desktop module.Any SM related imports that are no longer needed are removed.
> 
> This PR is limited to removing doPrivileged() calls and excludes any refactoring, reformatting, or other clean up that is out-of-scope for this fix.
> 
> PS: I have explicitly add comments to the changes where a more watchful review is required.

src/java.desktop/macosx/classes/com/apple/laf/AquaMenuBarUI.java line 148:

> 146:         // Do not allow AWT to set the screen menu bar if it's embedded in another UI toolkit
> 147:         if (LWCToolkit.isEmbedded()) return false;
> 148:         return Boolean.getBoolean(AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");

Review required

src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java line 62:

> 60: 
> 61:     static {
> 62:         String propValue = System.getProperty("apple.awt.dnd.defaultDragImageSize");

Review required

src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java line 154:

> 152:         }
> 153: 
> 154:         loadLibrary();

In-depth review required here.

src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java line 173:

> 171:         System.loadLibrary("awt");
> 172:         System.loadLibrary("fontmanager");
> 173:     }

Refactored System.loadLibrary() calls to a separate static method since they require @SuppressWarnings("restricted") annotation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22159#discussion_r1844328246
PR Review Comment: https://git.openjdk.org/jdk/pull/22159#discussion_r1844329443
PR Review Comment: https://git.openjdk.org/jdk/pull/22159#discussion_r1844327307
PR Review Comment: https://git.openjdk.org/jdk/pull/22159#discussion_r1844327414


More information about the client-libs-dev mailing list