RFR: 8342992: Security manager check should not use deprecated methods [v2]

Glavo duke at openjdk.org
Thu Nov 7 13:25:55 UTC 2024


On Thu, 7 Nov 2024 13:17:33 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> As specified in the security manager removal CSR, [JDK-8341858](https://bugs.openjdk.org/browse/JDK-8341858), JavaFX now checks at startup whether the security manager is enabled and fails fast with an `UnsupportedOperationException` if it is. The check is currently done in the `<clinit>` methods of `PlatformImpl` and `LauncherImpl` by calling the deprecated `System::getSecurityManager` method.
>> 
>> This PR creates a new `SecurityUtility::checkSecurityManager` utility method in `javafx.base` that uses reflection to avoid calling API that is deprecated for removal. I also added a call to `checkSecurityManager` in `ReflectUtil` and `MethodUtil` in `javafx.base` for non-graphical applications that only use `javafx.base`.
>
> Kevin Rushforth has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'master' into 8342992-check-sm
>  - 8342992: Security manager check should not use deprecated methods

modules/javafx.base/src/main/java/com/sun/javafx/SecurityUtil.java line 48:

> 46:      * @throws UnsupportedOperationException if the security manager is enabled
> 47:      */
> 48:     public static void checkSecurityManager() {

Can we cache the results of the check?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1627#discussion_r1832674262


More information about the openjfx-dev mailing list