[External] : Re: JEP draft: Prepare to Restrict The Use of JNI

Ron Pressler ron.pressler at oracle.com
Tue Aug 29 16:02:43 UTC 2023



> On 29 Aug 2023, at 16:47, Quân Anh Mai <anhmdq at gmail.com> wrote:
> 
> Hi,
> 
> There is a huge difference between --add-opens and --enable-native-access here. While the sole purpose of --add-opens is to break encapsulation and open implementation details, dependence on which is a major factor causing the friction of migration from 8 to 9, the purpose of JNI is not to break anything, but to simply enable native accesses from Java. While encapsulation breakage is possible in JNI, equating it as its sole purpose seems illogical. As a result, forcing the users to treat it similarly as --add-opens and friends seems not to be reasonable to me.
> 
> Thanks,
> Quan Anh


Hi.

There’s also a huge difference between -Xmx and --enable-native-access. I don’t think we’ve implied that breaking encapsulation is the sole purpose of JNI nor that --enable-native-access should be treated the same as --add-opens (it most certainly should not), but if you point out where in the language of the JEP you got that impression we’ll try to clarify.

— Ron


More information about the jdk-dev mailing list