RFR: 8327218: Add an ability to specify modules which should have native access enabled [v3]
Alan Bateman
alanb at openjdk.org
Thu Mar 7 09:36:54 UTC 2024
On Wed, 6 Mar 2024 21:16:25 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> Currently, JDK modules load by the bootstrap and platform ClassLoaders are automatically granted the native access. I am working on an upgrade of JLine inside the `jdk.internal.le` module, and I would like to replace the current native bindings with FFM-based bindings (which are now somewhat provided by JLine). But, for that, native access is needed for the `jdk.internal.le` module. We could possibly move the module to the platform ClassLoader, but it seems it might be better to have more control over which modules have the native access.
>>
>> This patch introduces an explicit list of modules that will automatically be granted the native access. Note this patch is not yet intended to change the end behavior - the list of modules granted native access is supposed to be the same as modules in the boot and platform ClassLoaders.
>
> Jan Lahoda has updated the pull request incrementally with three additional commits since the last revision:
>
> - Merge remote-tracking branch 'origin/native-access-modules1' into native-access-modules1
> - Reflecting review feedback.
> - Updating copyright headers.
Marked as reviewed by alanb (Reviewer).
src/java.base/share/classes/java/lang/ModuleLayer.java line 891:
> 889: * {@code false} otherwise
> 890: */
> 891: boolean addEnableNativeAccess(String name) {
Do you mind changing the method description to "Updates the module with the given name in this layer to allow access to restricted methods"? This will be keep it more consistent with the exiting methods.
Also "was present" in the return description hints that it may not now be present. A module layer is immutable so it can just say that it returns true if the module is in this layer.
-------------
PR Review: https://git.openjdk.org/jdk/pull/18106#pullrequestreview-1921919290
PR Review Comment: https://git.openjdk.org/jdk/pull/18106#discussion_r1515834537
More information about the build-dev
mailing list