RFR: 8344059: Remove doPrivileged calls from windows platform sources in the java.desktop module [v3]
Kevin Rushforth
kcr at openjdk.org
Thu Nov 14 18:46:12 UTC 2024
On Thu, 14 Nov 2024 18:24:43 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove GetPropertyAction
>
> src/java.desktop/windows/classes/sun/awt/windows/WFramePeer.java line 84:
>
>> 82: private static final boolean keepOnMinimize = "true".equals(
>> 83: new GetPropertyAction(
>> 84: "sun.awt.keepWorkingSetOnMinimize"));
>
> Shouldn't this be changed to `System.getProperty`? `GetPropertyAction` implements `PrivilegedAction` and is deprecated for removal (so I'm surprised that this doesn't generate a fatal warning).
Even more to the point: this won't work the way it used to: the former call to `doPrivileged` returned a String (the value of `GetPropertyAction::run`). The new code will use the `GetPropertyAction` instance itself without executing the run method, so you will be comparing a string `"true"` to the new `GetPropertyAction` instance, which will always be false since they aren't of the same type, regardless of what you set the property to. We had a similar issue with one of our JavaFX PRs that was only discovered by testing.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22083#discussion_r1842731237
More information about the client-libs-dev
mailing list