On Wed, 13 Nov 2024 23:19:32 GMT, Phil Race <[email protected]> wrote:
> This is the first of a number of PRs to remove doPrivileged uses in client
> libraries.
> These calls are obsolete dead code after JEP 486.
>
> I have run all our automated tests, including JCK tests, and manually tested
> SwingSet.
>
> One thing I might have missed in a couple of cases is that it seems that
> javac doesn't seem to notice if you leave an un-needed
> SuppressWarnings("removal") annotation.
>
> As per the bug report I am limiting (as much as I can) what I touch here to
> be just the immediate consequences of removing doPrivileged calls. These
> changes are plenty enough as it is.
Not a Reviewer, but checked some of the changes.
src/java.desktop/share/classes/javax/swing/RepaintManager.java line 216:
> 214: @SuppressWarnings("removal")
> 215: var t1 = "true".equals(AccessController.
> 216: doPrivileged(new GetPropertyAction(
Missed the GetPropertyAction import for this file (can't annotate there)
src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java
line 2186:
> 2184: AWTEventHelper() {
> 2185: super();
> 2186: run();
I don't think this method being called `run()` still makes sense when just
being called from the constructor, it used to make (more) sense when it was an
override from PrivilegedAction.
src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
line 150:
> 148: @SuppressWarnings("removal")
> 149: String systemFonts = AccessController.doPrivileged(
> 150: new
> GetPropertyAction("swing.useSystemFontSettings"));
Missed the GetPropertyAction import for this file (can't annotate there).
src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java line 150:
> 148: if (defaultI18NProperty == null) {
> 149: // determine default setting for i18n support
> 150: String o = System.getProperty(I18NProperty);
I believe the whole handling of `I18NProperty` (this line and the if-else
below) can be simplified to Boolean.getBoolean, similar to what has been done
in other places in this PR.
-------------
PR Review: https://git.openjdk.org/jdk/pull/22090#pullrequestreview-2436892099
PR Review Comment: https://git.openjdk.org/jdk/pull/22090#discussion_r1842706904
PR Review Comment: https://git.openjdk.org/jdk/pull/22090#discussion_r1842715788
PR Review Comment: https://git.openjdk.org/jdk/pull/22090#discussion_r1842723025
PR Review Comment: https://git.openjdk.org/jdk/pull/22090#discussion_r1842720574