On Mon, 2 Mar 2026 05:09:29 GMT, Phil Race <[email protected]> wrote:
> Remove AppContext from datatransfer classes.
> An obsoleted test is also removed.
src/java.desktop/share/classes/javax/swing/TransferHandler.java line 1732:
> 1730: return c.getToolkit().getSystemClipboard();
> 1731: }
> 1732: // Likely it is impossible to be here in headless.
We don't have a sandboxed environment and I am not sure that there is any way
to get here in a headless environment but I didn't want to return null just in
case.
src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java line 229:
> 227: * contents context.
> 228: *
> 229: */
This text should have been removed in an earlier fix, but was overlooked.
src/java.desktop/share/classes/sun/swing/SwingUtilities2.java line 1442:
> 1440: *
> 1441: */
> 1442: public static boolean canAccessSystemClipboard() {
The name of this method is what made me notice the usage of same-named methods
in InputEvent which I am removing in PR https://git.openjdk.org/jdk/pull/29987
Also I've removed the method as whilst it used to do more .. now all it does is
check for headless and the sole caller of this method can do this itself (see
the TransferHandler.java part of this PR)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29991#discussion_r2870549702
PR Review Comment: https://git.openjdk.org/jdk/pull/29991#discussion_r2870536730
PR Review Comment: https://git.openjdk.org/jdk/pull/29991#discussion_r2870542896