RFR: 8344231: SecurityManager cleanup in java.lang.module and jdk.internal.module

Alan Bateman alanb at openjdk.org
Fri Nov 15 06:36:45 UTC 2024


On Thu, 14 Nov 2024 17:32:40 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:

> Please review this PR which removes code depending on SecurityManager from the `java.lang.module` and `jdk.internal.module` packages:
> 
> * `ModuleFinder::ofSystem` is updated to not check the `"accessSystemModules"` RuntimePermission
> * The `ModuleReferences.ExplodedModuleReader` constructor is updated to remove the check that the caller has access to the directory.
> * `Modules::addProvides` is updated to not use `AccessController::doPrivileged` when getting the module class loader
> * `SystemModuleFinder::ofSystem` is updated to not returned a wrapped result calling `AccessController::doPrivileged`
> * `SystemModuleFinders.SystemImage` is updated to remove a class level comment referring to the SM
> * `SystemModuleFinders.SystemModuleReader::checkPermissionToConnect` is removed. The URI constructor parameter in `SystemModuleReader` becomes unused and is removed.
> 
> 
> Testing: I have run `test/jdk/java/lang/module`, `test/jdk/java/lang/ModuleTests`,  and `test/jdk/java/lang/ModuleLayer` successfully. GHA results pending.

Looks good, thanks for taking this one.

src/java.base/share/classes/jdk/internal/module/Modules.java line 158:

> 156:         ClassLoader loader = m.getClassLoader();
> 157: 
> 158:         ClassLoader platformClassLoader = ClassLoaders.platformClassLoader();

You can remove the blank line at L157 now, it was only there to make the doPriv use clearer.

src/java.base/share/classes/jdk/internal/module/SystemModuleFinders.java line 364:

> 362: 
> 363:     /**
> 364:      * Holder class for the ImageReader

In passing, you would mind adding a full stop after ImageReader. Only noticed it with the removal of the apinote.

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

Marked as reviewed by alanb (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/22113#pullrequestreview-2437774168
PR Review Comment: https://git.openjdk.org/jdk/pull/22113#discussion_r1843252012
PR Review Comment: https://git.openjdk.org/jdk/pull/22113#discussion_r1843252637


More information about the core-libs-dev mailing list