[jdk21u] RFR: 8367388: Tests start to fail on JDK-21 after JDK-8351907

Sergey Bylokhov serb at openjdk.org
Thu Sep 11 21:42:14 UTC 2025


After the patch for [JDK-8351907](https://bugs.openjdk.org/browse/JDK-8351907), in some cases it is no longer possible to load the XAWT toolkit under a SecurityManager in JDK 21.

The change in the mainline JDK removed the use of AccessController.doPrivileged, but in JDK 21u it is still required. Without it, access to system property (awt.robot.screenshotMethod) is blocked.

Fix: Restore use of [AccessController.doPrivileged](https://github.com/openjdk/jdk21u/commit/72d9bd69678dd54ef9e92f9c62073c0c4bf73c41#diff-2b4ac3949cd7faca02daa92815bd0e33d01f6f5b8914de2815d7cc5a864407f5L64) for property access in JDK 21u.
Verified with jdk_desktop group in both headful and headless modes.

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

Commit messages:
 - Add @SuppressWarnings("removal")
 - 8367388: Tests start to fail on JDK-21 after JDK-8351907

Changes: https://git.openjdk.org/jdk21u/pull/469/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk21u&pr=469&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8367388
  Stats: 7 lines in 1 file changed: 6 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk21u/pull/469.diff
  Fetch: git fetch https://git.openjdk.org/jdk21u.git pull/469/head:pull/469

PR: https://git.openjdk.org/jdk21u/pull/469


More information about the jdk-updates-dev mailing list