RFR: 8344896: Remove obsolete checks for AWTPermission accessClipboard [v2]

Phil Race prr at openjdk.org
Mon Nov 25 18:35:53 UTC 2024


On Mon, 25 Nov 2024 15:43:30 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

> few tests use this permission indirectly:
> 
> ```
> ./test/jdk/java/awt/datatransfer/Independence/IndependenceSwingTest.java:94:            sm.checkPermission(new AWTPermission("accessClipboard"));
> ./test/jdk/java/awt/datatransfer/Independence/IndependenceAWTTest.java:87:            sm.checkPermission(new AWTPermission("accessClipboard"));
> ./test/jdk/java/awt/datatransfer/SystemSelection/SystemSelectionSwingTest.java:87:                sm.checkPermission(new AWTPermission("accessClipboard"));
> ./test/jdk/java/awt/datatransfer/SystemSelection/SystemSelectionAWTTest.java:86:                sm.checkPermission(new AWTPermission("accessClipboard"));
> ```

I had listed these bugs in https://bugs.openjdk.org/browse/JDK-8344654 for @honkar-jdk to update.
I will check with her if she will get to these soon, otherwise I can address them here.

> src/java.desktop/share/classes/java/awt/event/InputEvent.java line 395:
> 
>> 393:             if (sm != null) {
>> 394:                 try {
>> 395:                     sm.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
> 
> `import sun.awt.AWTPermissions;` can be removed

OK

> src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java line 1239:
> 
>> 1237:         SecurityManager security = System.getSecurityManager();
>> 1238:         if (security != null) {
>> 1239:             security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
> 
> `import java.util.Hashtable;`
> `import sun.awt.AWTPermissions;`
> 
> can be removed

ok

> src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java line 684:
> 
>> 682:         SecurityManager security = System.getSecurityManager();
>> 683:         if (security != null) {
>> 684:             security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
> 
> unneeded `import sun.awt.AWTPermissions;`

ok

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

PR Comment: https://git.openjdk.org/jdk/pull/22356#issuecomment-2498754794
PR Review Comment: https://git.openjdk.org/jdk/pull/22356#discussion_r1857160474
PR Review Comment: https://git.openjdk.org/jdk/pull/22356#discussion_r1857161055
PR Review Comment: https://git.openjdk.org/jdk/pull/22356#discussion_r1857160687


More information about the client-libs-dev mailing list