Skip to content

Conversation

@prrace
Copy link
Contributor

@prrace prrace commented Nov 25, 2024

This removes the SecurityManager related checks for clipboard access and methods which exist solely to support that.

One interesting thing is that there are two places where a method "canAccessSystemClipboard()" was not only about the SM.
In SwingUtilities and InputEvent it would return false in headless mode, regardless of whether there is an SM.
This means I have left the methods in place, behaving the same as before in headless mode.
We may be able to further simplify this later but it will be clearer with the SM-only logic removed and out of scope for this fix.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8344896: Remove obsolete checks for AWTPermission accessClipboard (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22356/head:pull/22356
$ git checkout pull/22356

Update a local copy of the PR:
$ git checkout pull/22356
$ git pull https://git.openjdk.org/jdk.git pull/22356/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22356

View PR using the GUI difftool:
$ git pr show -t 22356

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22356.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 25, 2024

👋 Welcome back prr! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 25, 2024

@prrace This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8344896: Remove obsolete checks for AWTPermission accessClipboard

Reviewed-by: azvegint

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 18 new commits pushed to the master branch:

  • 08dfc4a: 8344213: Cleanup OpaqueLoop*Node verification code for Assertion Predicates
  • 593a589: 8344319: SM cleanup in jdk.dynalink module
  • 15ae8d0: 8319993: Update Unicode Data Files to 16.0.0
  • a032de2: 8344577: Virtual thread tests are timing out on some macOS systems
  • 4110d39: 8344865: SM cleanup in sun/reflect/annotation
  • 1334191: 8334474: RISC-V: verify perf of ExpandBits/CompressBits (rvv)
  • e29b0ed: 8344181: Remove SecurityManager and related calls from jdk.management and jdk.management.agent
  • cb1c736: 8344363: FullGCForwarding::initialize_flags is called after ObjLayout::initialize
  • c6b14c6: 8344841: ClassPrinter prints confusing value for null
  • ddc8a9d: 8344366: Remove Security Manager dependencies from javax.net.ssl and sun.security.ssl packages
  • ... and 8 more: https://git.openjdk.org/jdk/compare/6f622da7fbae67d8c1cd9e795127adac58a246a9...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title 8344896 8344896: Remove obsolete checks for AWTPermission accessClipboard Nov 25, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 25, 2024
@openjdk
Copy link

openjdk bot commented Nov 25, 2024

@prrace The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Nov 25, 2024
@prrace
Copy link
Contributor Author

prrace commented Nov 25, 2024

I did not remove ACCESS_CLIPBOARD_PERMISSION from sun.awt.AWTPermissions since I am concurrently updating that class in a different PR (https://git.openjdk.org/jdk/pull/22350) , and I know that I will be able to revisit the class when deprecating java.awt.AWTPermission.
But if https://git.openjdk.org/jdk/pull/22350 is approved earlier than this one, I may add the removal here.

@mlbridge
Copy link

mlbridge bot commented Nov 25, 2024

Webrevs

Copy link
Member

@azvegint azvegint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"));

@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import java.util.Hashtable;
import sun.awt.AWTPermissions;

can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@prrace
Copy link
Contributor Author

prrace commented Nov 25, 2024

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.

Copy link
Member

@azvegint azvegint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Good to know, I guess we can leave them for the JDK-8344654 then.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 25, 2024
@honkar-jdk
Copy link
Contributor

@azvegint

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.

I have these tests updated as part of the JBS mentioned above (not created a PR yet).

@prrace
Copy link
Contributor Author

prrace commented Nov 25, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Nov 25, 2024

Going to push as commit 4d898aa.
Since your change was applied there have been 18 commits pushed to the master branch:

  • 08dfc4a: 8344213: Cleanup OpaqueLoop*Node verification code for Assertion Predicates
  • 593a589: 8344319: SM cleanup in jdk.dynalink module
  • 15ae8d0: 8319993: Update Unicode Data Files to 16.0.0
  • a032de2: 8344577: Virtual thread tests are timing out on some macOS systems
  • 4110d39: 8344865: SM cleanup in sun/reflect/annotation
  • 1334191: 8334474: RISC-V: verify perf of ExpandBits/CompressBits (rvv)
  • e29b0ed: 8344181: Remove SecurityManager and related calls from jdk.management and jdk.management.agent
  • cb1c736: 8344363: FullGCForwarding::initialize_flags is called after ObjLayout::initialize
  • c6b14c6: 8344841: ClassPrinter prints confusing value for null
  • ddc8a9d: 8344366: Remove Security Manager dependencies from javax.net.ssl and sun.security.ssl packages
  • ... and 8 more: https://git.openjdk.org/jdk/compare/6f622da7fbae67d8c1cd9e795127adac58a246a9...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 25, 2024
@openjdk openjdk bot closed this Nov 25, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 25, 2024
@openjdk
Copy link

openjdk bot commented Nov 25, 2024

@prrace Pushed as commit 4d898aa.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client client-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants