On Thu, 14 Nov 2024 18:29:29 GMT, altrisi <[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.
>
> 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.

I thought about that, but I was limiting the changes.

> 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).

another one for a follow-up

> 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.

I noticed but I did not want to change the pattern any more than I was forced 
to, so I left it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22090#discussion_r1842783019
PR Review Comment: https://git.openjdk.org/jdk/pull/22090#discussion_r1842785690
PR Review Comment: https://git.openjdk.org/jdk/pull/22090#discussion_r1842785165

Reply via email to